Skip to main content

전화번호 생성기

#


#

package pro_04_08;

 

import java.util.Random;

 

public class PhoneNumbers {

 

public static void main(String[] args) {

// TODO Auto-generated method stub

Random rand = new Random();

String PhoneNumber = "0";

PhoneNumber += rand.nextInt(5)+2;

PhoneNumber += rand.nextInt(5)+1;

PhoneNumber +="-";

PhoneNumber += rand.nextInt(10);

PhoneNumber += rand.nextInt(10);

PhoneNumber += rand.nextInt(10);

PhoneNumber +="-";

PhoneNumber += rand.nextInt(10);

PhoneNumber += rand.nextInt(10);

PhoneNumber += rand.nextInt(10);

PhoneNumber += rand.nextInt(10);

System.out.println("생성된 전호번호 : " + PhoneNumber);




#


Comments