매니저/JAVA1

JAVA1 interface 예제2 (임시저장)

cdprkr2077 2011. 12. 23. 20:49


// 다중 상속이 된다.

interface Inter1
{
 int a = 10;
 public int getA();
}

interface Inter2
{
 int b = 20;
 public int getB();
}

class InterEx2 implements Inter1, Inter2
{
 public int getA()
 {
  return a;
 }

 public int getB()
 {
  return b;
 }

 public static void main( String[] args )
 {
  InterEx2 ie = new InterEx2();
  System.out.println( "a : " + ie.getA() );
  System.out.println( "b : " + ie.getB() );
 }
}