1번 ) 숫자와 문자열

public class Test5 {

	public static void main(String[] args) {
		int x = 1, y = 2, z =3;
		System.out.println(x + y + z + "4");

	}

}

<출력결과>

64

<설명>

System.out.println(x + y + z + "4"); ⇒ 64

//숫자 + 숫자 + “문자” = 숫자 계산 후 문자가 붙음

System.out.println(”4” + x + y + z + "4"); ⇒ 41234

//“문자” + 숫자 + 숫자 + “문자” = 숫자가 문자열로 인식되어 계산되지 않고 그대로 붙여서 출력

System.out.println(”4” + x + y + z ); ⇒4123

//“문자” + 숫자 + 숫자 = 숫자가 문자열로 인식되어 계산되지 않고 그대로 붙여서 출력

<추가 설명>

    System.out.println(19 + 99 + "응답하라");
		System.out.println("" + 19 + 99 + "응답하라");

<출력결과>

118응답하라 1999응답하라

2번) 반복문과 continue 그리고break

public class Test5 {

	public static void main(String[] args) {
		 for (int i = 0; i <10; i++) {
			if(i % 2 == 0) continue;
			if(i % 5 == 0) break;
			System.out.print(i);
		}

	}

}

<출력결과>

13

<설명>