I am working through a book called Sun Certified Programmer & Developer for
Java 2 by Kathy Sierra and Bert Bates(Osborne books). The chapter of the book that I am working on called Declarations and Modifiers(Exam Objective 1.2). The section that I am working on is called Public Members. The book example is:
package book;
import cert.*; // Import all classes in the cert package
class Goo {
public static void main(
String [] args) {
Sludge o = new Sludge();
o.testIt();
}
}
second file:
package cert;
public class Sludge {
public void testIt() {
System.out.println("sludge");
}
Goo should be able to invoke the method in Sludge without problems because both the sludge class and its testIt () method are marked public.
But this the result:
Attempt to compile:
D:\j2sdk1.4.2_01\bin\cert\book>javac Goo.java
Goo.java:2: package cert does not exist
import cert.*; // Import all classes in the cert package
^
Goo.java:7: cannot resolve symbol
symbol : class Sludge
location: class book.Goo
Sludge o = new Sludge();
^
Goo.java:7: cannot resolve symbol
symbol : class Sludge
location: class book.Goo
Sludge o = new Sludge();
^
3 errors
D:\j2sdk1.4.2_01\bin\cert\book>
Where am I going wrong?