interface Person
{
int age=25;
void printinfo();
}
interface personInterface extends Person
{
int age=30;
void printinfo();
}
public class Studens implements personInterface {
//Students类实现personInterface接口
public void printinfo() //实现接口的方法Printinfo()
{
System.out.println("年龄:"+age);//实现接口中的常量age
}
public static void main(String[] args)
{
Studens x= new Studens();
x.printinfo();
}
}
- 1
- 2
前往页