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
    
    
  'JAVA > 예제' 카테고리의 다른 글
| [JAVA] ch07-10. 싱글톤 기법 (singleton) (0) | 2017.08.22 | 
|---|---|
| [JAVA] ch07-09. 객체 지향 9 (0) | 2017.08.22 | 
| [JAVA] ch07-06. 객체 지향 6 (0) | 2017.08.22 | 
| [JAVA] ch07-05. 객체 지향 5 (0) | 2017.08.22 | 
| [JAVA] ch07-04. 객체 지향 4 (0) | 2017.08.22 | 
 
			
			 
				
			
댓글