import package.*与import package.class结果不一样
代码大致是这样:
package section1;
/**
* Created by Janice on 2016/8/10.
*/
public class Telphone {
public Telphone(){
System.out.println("section1无参");
}
主函数:
package section1;
/**
* Created by Janice on 2016/8/10.
*/
public class inTelphone {
public static void main(String[] args){
Telphone phone=new Telphone(); }
}
建立一个同级包
package section11;
/**
* Created by Janice on 2016/8/10.
*/
public class Telphone {
public Telphone(){
System.out.println("section11");
}
}
然后在package section1的主函数中import section11.*;结果是section1无参
import section11.Telphone;结果是section11
为什么