interface Nl
{
int year = 2012;
int age();
void output();
}
public class InterfaceTest implements Nl
{
String xm;
int csrq;
InterfaceTest(String nl,int y)
{
xm = nl;
csrq = y;
}
public int age()
{
return year - csrq;
}
public void output()
{
System.out.println(this.xm+" "+this.age());
}
public static void main(String[] args)
{
InterfaceTest a = new InterfaceTest("aaa",1980);
a.output();
}
}
接口问题
最新推荐文章于 2021-10-09 22:44:18 发布