ackage 삼월이십일; 

public class CardTest { 
public static void main(String args[]) { 
System.out.println("Card.width =" + Card.width); 
System.out.println("Card.height=" + Card.height); 

Card c1 = new Card(); 
c1.kind = "Heart"; 
c1.number = 7; 

Card c2 = new Card(); 
c2.kind = "Space"; 
c2.number = 4; 

System.out.println("c1 은 " + c1.kind + "," + c1.number 
+"이며, 크기는 ("+ c1.width +"," +c1.height +")"); 
System.out.println("c2 은 " + c2.kind + "," + c2.number 
+"이며, 크기는 ("+ c2.width +"," +c2.height +")"); 

System.out.println("c1의  width와 height 를 각각 50, 80으로 변경합니다"); 
c1.width = 50; 
c1.height = 80; 

System.out.println("c1 은 " + c1.kind + "," + c1.number 
+"이며, 크기는 ("+ c2.width +"," +c2.height +")"); 
System.out.println("c2 은 " + c2.kind + "," + c2.number 
+"이며, 크기는 ("+ c2.width +"," +c2.height +")"); 





class Card { 
String kind; 
int number; 
static int width = 100; 
static int height = 250; 






package 삼월이십일; 

public class ReferenceParamEx2 { 
public static void main(String args[]) { 

int [] x = {10}; 
System.out.println("main () : x =" + x[0]); 

change(x); 
System.out.println("After change(x)"); 
System.out.println("main() : x ="  + x[0]); 


static void change(int[] x){ 
x[0] = 1000; 
System.out.println("change(): x=" + x[0]); 




'Java' 카테고리의 다른 글

9. 아홉번째 개발 공부  (0) 2018.03.28
8. 여덞번째 개발공부  (0) 2018.03.28
6.여섯번째 개발 공부  (0) 2018.03.28
5. 다섯번째 개발 공부  (0) 2018.03.28
4.네번째 개발 공부  (0) 2018.03.28

+ Recent posts