class Zoo
{
public
String coolMethod(){
return "Wow baby";
}
}
class Moo
{
public void useAZoo(){
Zoo z=new Zoo();
//If the preceding line complies Moo has access the Zoo class.
//But... does it have access to coolMethod()?
System.out.println("A Zoo says " +z.coolMethod());
//the preceding line works because Moo can access the public method
}
}
i have complied this code and when running the program it exception java.lang.NoSuchMethodError:main
this examples is from K&B page no 25
there is point, "whether method code in one class can access a member of another class"
please guide me for the above code.
thank you,
trupti.