ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Java - 생성자
    개발노하우/Java 2007. 4. 18. 12:55

    class privat_sub{
     private int x=100;
     private char y='a';
    //  public void viewX(){
    //  System.out.println("x="+x);
    // }
     
     public void x(int x)
     {
      this.x = x;
     }
     public void y(char y)
     {
      this.y = y;
     }
     public int x()
     {
      return x;
     }
     public char y()
     {
      return y;
     }
    }

    public class privat {
     public static void main(String[] ar){
      privat_sub pr = new privat_sub();;
      System.out.println("x="+pr.x());
      // pr.viewX();
      System.out.println("y="+pr.y());
     }
    }

Designed by Tistory.