목록JAVA (8)
최's 먹공로그
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 package algo; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; imp..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 package org.opentutorials.javatutorials.switch_statement; public class switch_statement { public static void main(String[] args) { System.out.println("switch(1)"); switch(1){ case 1: Sy..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 package org.opentutorials.javatutorials.string; public class string { public static void main(String[] args) { System.out.println('생'); // ' 작은 따옴표는 문자! System.out.println("생홡코딩"); // " 큰 따옴표는 문자열! // System.out.println('생활코딩'); 문자열은 ' 작은 따옴표로 안됨! System.out.println("생"); // 문자는 " 큰 따옴표도 가능! System.out.println("egoing said \"Welcome\""); // \를 앞에 붙여주면 ' ..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 package org.opentutorials.javatutorials.operator; public class operator { public static void main(String[] args) { // 연산자 int result = 1+2; System.out.println(result); result = result - 1; System.out.println(result); result = result * 2; System.out.pr..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 package org.opentutorials.javatutorials.if_statement; public class if_statement { public static void main(String[] args) { if(false) { System.out.println("result : true"); } else { System.out.println("result : false"); } if(false) { System.out.println(1); System.out.println(2); System.o..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 package org.opentutorials.javatutorials.constant; public class constant { public static void main(String[] args) { float a=2.2; // 오류발생 float b=2.2F; // float 사용 double c = 2.2; // 기본적으로 소수점은 double int d = 2147483648; // int의 범위 초과 long e = 2147483648; // 오류발생 long f = 2147483648L; // long 사용 byte g = 100; short h = 200; } } Colored by Color Scrip..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 package org.opentutorials.javatutorials.comment; public class comment { public static void main(String[] args) { // 한 줄 주석 /* 여러줄~~~ ~~~ ~~~ */ /** * java doc 주석 */ /* * 단축키 ctrl + shift + / * 해제 단축키 ctrl + shift + \ * int a; a = 2; System.out.println(a);*/ // 단축키 ctrl + / // int a; // a = 2; // System.out.println(a..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 package org.opentutorials.javatutorials.bool; public class bool { public static void main(String[] args) { System.out.println(1 == 3); // false System.out.println(1 == 1); // true System.out.println("one" == "two"); System.out.println("one" == "one"); System.out.println(1 != 3); // true System.out.println(1 != 1); // false Syst..