- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChapter15.java
More file actions
Latest commit
46 lines (32 loc) · 1.29 KB
/
Copy pathChapter15.java
File metadata and controls
46 lines (32 loc) · 1.29 KB
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
packagejavastudy;
classAvante {
//클래스 변수
staticStringcompany = "현대";
//인스턴스(객체) 변수
Stringcolor;
}
publicclassChapter15 {
publicstaticvoidmain(String[] args) {
//클래스 변수 사용 : 객체 생성 없이 사용할 경우 클래스명.변수명
System.out.println("Avante 제조사 = " + Avante.company);
System.out.println("-----------------------");
Avantea1 = newAvante();
System.out.println("a1 객체 제조사 = " + a1.company);
System.out.println("a1 객체 색상 = " + a1.color);
System.out.println("-----------------------");
a1.company = "KIA";
Avantea2 = newAvante();
System.out.println("a2 객체 제조사 = " + a2.company);
System.out.println("a2 객체 색상 = " + a2.color);
System.out.println("-----------------------");
//a1.company = "KIA";
Avantea3 = newAvante();
System.out.println("a3 객체 제조사 = " + a3.company);
System.out.println("a3 객체 색상 = " + a3.color);
System.out.println("-----------------------");
Avantea4 = newAvante();
System.out.println("a4 객체 제조사 = " + a4.company);
System.out.println("a4 객체 색상 = " + a4.color);
System.out.println("-----------------------");
}
}