-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEx003.java
More file actions
41 lines (32 loc) ยท 770 Bytes
/
Ex003.java
File metadata and controls
41 lines (32 loc) ยท 770 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
/*=====================================
โ โ โ ์๋ฐ ๊ธฐ๋ณธ ํ๋ก๊ทธ๋๋ฐ โ โ โ
- ๋ณ์์ ์๋ฃํ
======================================*/
public class Ex003
{
public static void main(String[] args)
{
// ๋ณ์ ์ ์ธ
int a;
// ๋ณ์ a์ 10 ๋์
(๋ณ์ ์ด๊ธฐํ)
a = 10;
// ๋ณ์ ์ ์ธ๊ณผ ๋์์ ์ด๊ธฐํ(์ ์ธ๊ณผ ๋์
์ ํ ๋ฒ์ ์ฒ๋ฆฌ)
int b = 20;
a = 30;
// ๋ณ์ ์ ์ธ
int c;
// ํ
์คํธ ๋ฐ ํ์ธ
System.out.println("a:" + a);
System.out.println("b:" + b);
//System.out.println("c:" + c);
//--===>> ์๋ฌ ๋ฐ์(์ปดํ์ผ ์๋ฌ)
// ์ฐ์ฐ ๋ฐ ์ฒ๋ฆฌ
c = a + b;
// c = 30 + b
// c = 30 + 20
// c = 50
// ํ์ธ
System.out.println("c:" + c);
//-==>> 50
}
}