JAVA/예제
[JAVA] ch07-08. 객체 지향 8
밍글링글링
2017. 8. 22. 11:38
728x90
public class Ex08 {
public static void main(String[] args){
Paper paper = new Paper(10, "HEART");
//paper.NUMBER = 5;
System.out.println(paper.NUMBER);
System.out.println(paper.KIND);
}
}
//public 메서드호출
//private 멤버변수
class Paper{
final int NUMBER;
final String KIND;
static int width = 100;
static int height = 250;
Paper(){
this(1,"HEART");
}
Paper(int number, String kind){
this.NUMBER = number;
this.KIND = kind;
}
}
728x90