hello,
Why cnnot i have a public class or public static void main
inside a package why does it give error.
The code below is for reference.
package hello;
class pack1 {
void show()
{
System.out.println("Hello pack1");
}
}
class subpack1 extends pack1 {
void show()
{
System.out.println("Hello subpack1");
}
}
class diffpack {
void show()
{
System.out.println("Hello pack1");
}
}
class xyz {
public static void main(
String args[])
{
pack1 a = new subpack1();
a.show();
diffpack b = new diffpack();
b.show();
}
}
- thanks in Advance
regards
- mohan