
import java.util.Random;
public class Main {
public static void main(String[] args) {
String[] fst= {"기절초풍","멋있는","재미있는"};
String[] sec= {"도전적인","노란색의","바보같은"};
String[] thi= {"돌고래","개발자","오랑우탄"};
// 랜덤 객체 생성
Random rm = new Random();
// 랜덤 인덱스 생성
int fst_rm = rm.nextInt(fst.length);
int sec_rm = rm.nextInt(sec.length);
int thi_rm = rm.nextInt(thi.length);
System.out.println(fst[fst_rm]+" + "+sec[sec_rm]
+" + "+thi[thi_rm]);
}
}'내일배움캠프 STEP 2. 속도에 맞춰 나아가기 > JAVA 응용하기' 카테고리의 다른 글
| 가위 바위 보! (1) | 2024.10.22 |
|---|---|
| Lv3. 단어 맞추기 게임 (0) | 2024.10.22 |
| Lv2. 스파르타 자판기 (0) | 2024.10.22 |