[JAVA] 20자리 Serial Number 구성하기 [반복문 for과 Math.random() 활용]
·
◎ Java/Java☕
[JAVA] 반복문 for[for문, 중첩 for문, 별 찍기, 구구단] 1. 반복문이란? - for, while, do-while '반복문'은 주어진 조건을 만족하는 동안 주어진 문장들을 반복적으로 수행되도록 할 때 사용된다. 반복문의 종류로는 for문과 while문, while문의 변형인 do-while문 yermi.tistory.com - 20자리 Serial Number 구성하기 public class Serial { public static void main(String[] args) { // 20자리의 영대문자, 영소문자, 숫자의 조합을 하고 있는 문자열 제작 String str = ""; for (int i = 0 ; i < 20 ; i++) { // 26 영대문자 범위, 26 영소문자 범위..
[JAVA] 윷놀이 만들기(Yut Play) [Math.random()과 조건문 switch 활용]
·
◎ Java/Java☕
[JAVA] 조건문 switch[하나의 조건식으로 많은 경우의 수 처리하기] 1. 조건문 switch switch문은 단 하나의 조건식으로 많은 경우의 수를 처리할 수 있다. switch문은 아래와 같다. 1. 조건식을 계산한다. 2. 조건식의 결과와 일치하는 case문으로 이동한다. 3. 이후의 문 yermi.tistory.com - 윷놀이 만들기(Yut Play) public class YutPlay { public static void main(String[] args) { for (int i = 0 ; i < 20 ; i++) { int play = (int)(Math.random() * 16 + 1); switch (play) { case 1: System.out.println("\'빽도\'입니..