您的位置:首页 > 其它

Myinterface

2015-10-01 17:38 369 查看
public class Computer {
private int size;
public Computer()
{
System.out.println("create a computer.");
}
public Computer(int size)
{
this();
this.size=size;
}

}


public interface Portable {
public boolean isPortable();
}


public class PortableComputer extends Computer implements Portable{
public PortableComputer()
{
super();
}
public PortableComputer(int mySize)
{
super(mySize);
}
public boolean isPortable()
{
return true;
}
}


public class TestPortable {
public static void main(String [] args)
{
PortableComputer computer =new PortableComputer();
System.out.println("computer is portable?"+ computer.isPortable());
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: