interface Animal1
{
int ID =1;
void shout();
void run();
}
class Dog implements Animal1
{
public void shout ()
{
System.out.println("汪汪");
}
public void run()
{
System.out.println("狗四条腿跑得很快");
}
}
class Animal1Test
{
public static void main (String []args)
{
Dog d = new Dog();
d.shout();
d.run();
}
}
//Dog类中的方法得是public修饰 |
|