I was trying this...
In a common package (in eclipse) i placed two files as follows:-
1) p1.java
public class p1 {
public static void main(
String[] args)
{
System.out.println("Hello!");
p2 p = new p2();
p.disp();
}
}
class p2
{
void disp()
{
System.out.println("From class p2");
}
}
2) p2.java
class p3
{
// strange!! execute this file we will get output of p1.java
}
class p4
{
}
if we will execute p2.java it shows output of p1.java
please explain.