标签:
同一个包myjava中:
主程序myjava.java类文件
package myjava;
import myjava.*;
public class myjava implements Jinterface {
public void eat(){
System.out.println("Mammal eats");
}
public void travel(){
System.out.println("Mammal travels");
}
public int noOfLegs(){
return 0;
}
public static void main(String[] args) {
myjava m = new myjava();
m.eat();
m.travel();
jclass.hello();
}
}
接口Jinterface.java文件
package myjava;
public interface Jinterface {
public void eat();
public void travel();
}
普通类文件jclass
package myjava;
public interface Jinterface {
public void eat();
public void travel();
}
标签:
原文地址:http://blog.csdn.net/szming_blog/article/details/45287215