1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | /* * '+' 연산자의 의미 * - 산술연산자인 더하기의 의미 * - 연결하여 출력하는 연결연산자 * - 연산의 방향에 의해 연결연산자인지 산술연산자인지가 결정된다. * 10 + 2 * */ public class Exam_04 { public static void main(String[] ar){ int x = 12; int y = 24; System.out.println(x+y); // 36 System.out.println("x = " + x); // x = 12 System.out.println("" + x + y); // 1224 System.out.println(x + 'a'); // 12+97 System.out.println(x + "a" + y); //12a24 System.out.println(x + "a" + y * 2);//12a48 System.out.println('A' + 'B'); // 65+66 } } | cs |
'공부 > JAVA_source' 카테고리의 다른 글
자바 입출력 (1) (0) | 2016.10.19 |
---|---|
자바 예외처리 (throws IOException) (0) | 2016.10.19 |
자바 입출력 (0) | 2016.10.19 |
자바 System 클래스 (write/print/println/printf) (0) | 2016.10.19 |
자바 출력 스트림 (0) | 2016.10.19 |