why to declareSuperclass in another file?
807598Oct 24 2006 — edited Oct 24 2006i am having an error in the following program.plz tell me why.
public class Superclass
{
public void ss()
{
System.out.println("Hello World!from subclass");
}
}
public class Subclass extends Superclass
{
public static void main(String[] args)
{
System.out.println("Hello World!");
Superclass su = new Superclass();
su.ss();
}
}
the error it is giving is:
class Superclass is public,should be declared in a file named Superclass.java.
i am not getting the error if i change the accessibility to default.is it a error to declare both the classes as public.