I have build two classes named PackageTest.java (in the desktop dir) and Employee.java (in the desktop/com/wenhu/corejava dir).
In the Employee.java file, I wrote in the first line:
package com.wenhu.corejava;
Then in the PackageTest.java file, I wrote in the first line:
import com.wenhu.corejava.*;
However, the compiler complains:
PackageTest.java:8: error: cannot access Employee
Employee harry = new Employee("Harry", 50000, 1989, 10, 1);
^
bad class file: .\Employee.class
class file contains wrong class: com.wenhu.corejava.Employee
Please remove or make sure it appears in the correct subdirectory of the classpath.
1 error
Interestingly, if I wrote:
import com.wenhu.corejava.Employee;
The compiler is OK! Could anyone tell me why this is happened? I though the wildcard * could represent the Employee Class...
Thanks a lot!