S
spaceshop
Unregistered / Unconfirmed
GUEST, unregistred user!
import mypackage.Employee;
public class Test{
public static void main( String args[]) {
Employee a = new Employee(5);
a.setAge(4);
System.out.println("Employee age:"+a.getAge());
}
}
现在程序没问题,但如果导入部分改为import mypackage.*;
运行:javac Test.java
出错:Test.java :8 : cannot access Employee
bad class file: ./Employee.java
filedo
es not contain class Employee
please remove or make sure it appears in the correct subdirectory of the classpath.
Employee a = new Employee(5);
1 error
请大家帮忙解释一下原因,为什么一定要指明类名,而不能用星号代替?谢谢!
注: windows 2k ,j2sdk1.4.2
目录结构:C:/te/Employee.java
c:/te/Test.java
c:/mypackage/Employee.class
类路径设定: .;c:/ (无关的略掉)
public class Test{
public static void main( String args[]) {
Employee a = new Employee(5);
a.setAge(4);
System.out.println("Employee age:"+a.getAge());
}
}
现在程序没问题,但如果导入部分改为import mypackage.*;
运行:javac Test.java
出错:Test.java :8 : cannot access Employee
bad class file: ./Employee.java
filedo
es not contain class Employee
please remove or make sure it appears in the correct subdirectory of the classpath.
Employee a = new Employee(5);
1 error
请大家帮忙解释一下原因,为什么一定要指明类名,而不能用星号代替?谢谢!
注: windows 2k ,j2sdk1.4.2
目录结构:C:/te/Employee.java
c:/te/Test.java
c:/mypackage/Employee.class
类路径设定: .;c:/ (无关的略掉)