일곱번째 개발일지

By @a9911023/20/2018kr

안녕하세요 #a991102 입니다.
오늘은 시간이 늦은 관계로 이론은 설명못드릴것 같습니다 ㅠㅠ
나중에는 이론도 같이 가져오겠습니다.

package 삼월이십일;

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]);
	}
}

comments