-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVarEx01.java
More file actions
44 lines (31 loc) · 869 Bytes
/
Copy pathVarEx01.java
File metadata and controls
44 lines (31 loc) · 869 Bytes
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
package java1;
public class VarEx01 {
public static void main(String[] args) {
int num = 10; // num -> 380009232번지
System.out.println(num);
num = 50;
System.out.println(num);
// 변수의 선언
int phone;// 4byte =32bit
// System.out.println(phone);초기화되지 않아서 오류
// 변수의 초기화
phone = 1033318212;
System.out.println(phone);
// 타입 변수명 = 값;
byte smallNum = 100; // 1byte = 8bit
System.out.println(smallNum);
double doubleNum = 10.5; // 8byte = 64bit
System.out.println(doubleNum);
int testNum1 = 100;
double testNum2 = 10.5;
testNum2 = testNum1; // 묵시적 형변환
int testNum3 = 100;
double testNum4 = 10.5;
testNum3 = (int) testNum4;// 명시적 형변환(강제)
// boolean -> 0,1 -> false, true
boolean check = true;
System.out.println(check);
int dataNum = 20;
System.out.println(1 == 1);
}
}