자바 개발 환경 구축

 

JRE = JVM + 표준 클래스 라이브러리

JDK = JRE + 개발도구

 

변수

하나의 값을 저장할 있는 메모리 공간

 

변수의 선언 : ex) int, double, String, char, boolean etc

 

int value;                           //  변수 value 선언

Int result = value + 100;  //  value + 100 값을 선언된 result 저장


boolean 예제


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package ch3;
 
public class DenyExample {
 
    public static void main(String[] args) {
        boolean run = true;
        System.out.println(run);    // true
        
        run = !run;
        System.out.println(run);    // false
        
        run = !run;
        System.out.println(run);    // true    
    }
}
cs


String 예제


1
2
3
4
5
6
7
8
9
10
11
12
package ch3;
 
public class StringExample {
 
    public static void main(String[] args) {
        String str1 = "호랑이";
        String str2 = "6.0";
        String str3 = str1 + str2;
        System.out.println(str3);
    }
}
 
cs


+ Recent posts