Java 4일차 Interface 테스트

interface InterfaceTest00
{
abstract void interfaceTest00();
}

interface InterfaceTest01 extends InterfaceTest00
{
public int i = 767;
public int k = 999;
public void interfaceTest01(int i, int k);
}

interface InterfaceTest02
{
int j =747;
public int privateInt = 8;
public void interfaceTest02(int j);
}

class SuperClass
{
String superStr = "Super";
String superMethod()
{
System.out.println("SuperClass.SuperMethod()");
return "returnString";
}
}

class SubClassTest01 extends SuperClass implements InterfaceTest01
{
public void interfaceTest00()
{
}

public void interfaceTest01(int i, int k)
{
}

}

abstract class SubClassTest02 extends SuperClass implements InterfaceTest01, InterfaceTest02
{
}

class SubClassTest03 extends SuperClass implements InterfaceTest01, InterfaceTest02
{
public void interfaceTest00()
{

}

public void interfaceTest02(int j)
{
}

public void interfaceTest01(int i, int k)
{

}
}

class SubClassTest04 extends SubClassTest02
{
//여기에 필요한 것들을 추가하여 문제를 해결하세요..
SubClassTest04()
{
System.out.println("subClassTest04() 객체 생성");
System.out.println(" i = "+i);
System.out.println(" j = "+j);
}

SubClassTest04(String s1, String s2)
{
System.out.println(s1+" 타입 "+"subClassTest04("+s2+") 객체 생성");
}

public void printSuperString()
{
// InterfaceTest01 ie01 = new InterfaceTest01();
System.out.println(" superString = "+superStr);
}

public void interfaceTest01(int i, int k)
{
System.out.println("SubClassTest04.interfaceTest00()");
}

public void interfaceTest00()
{
}

public void interfaceTest02(int j)
{
}

}


public class InterfaceTest
{
public static void main(String args[])
 {
SubClassTest02 sub02sub04 = new SubClassTest04("SubClassTest02", "sub02sub04");
SuperClass superSub04 = new SubClassTest04("SuperClassTest", "superSub04");
InterfaceTest01 if01Sub04 = new SubClassTest04("InterfaceTest01", "ifc01Sub04");
SubClassTest04 sub04 = new SubClassTest04();
sub04.interfaceTest00();
sub04.interfaceTest01(1, 7);
sub04.superMethod();
}
}

댓글 없음: