i have two files 1) MyClass.java 2)Another.java
Directory Structure D:\chap10\com\foo
Both files are in foo folder
MyClass.java contain following code
package com.foo;
public class MyClass
{
public void hi() {System.out.println("hi?");}
}
Another.java contain following code
package com.foo;
import com.foo.*;
public class Another {
void go() {
MyClass m1 = new MyClass();
com.foo.MyClass m2 = new com.foo.MyClass();
m1.hi();
m2.hi();
}
public static void main(
String [] args)
{
Another an = new Another();
an.go();
}
}
Following error occur when Another.java is compiled
D:\ExamPractice\com\foo>javac Another.java
Another.java:9: cannot find symbol
symbol : class MyClass
location: class com.foo.Another
MyClass m1 = new MyClass();
^
Another.java:9: cannot find symbol
symbol : class MyClass
location: class com.foo.Another
MyClass m1 = new MyClass();
^
Another.java:10: cannot find symbol
symbol : class MyClass
location: class com.foo.Another
MyClass m2 = new MyClass();
^
Another.java:10: cannot find symbol
symbol : class MyClass
location: class com.foo.Another
MyClass m2 = new MyClass();
^
4 errors
Refer to example on page 769
SCJP study guide by Kathy Sierra & Bert Bates