
Hi,
I have two different java programs like sun and moon. In both of these two programs i have used same class name like A. For example,
File name:sun.java
Then the code is here:
Class A
{
public static void main(String args[])
{
System.out.println("Hai");
}
}
Then i have to compile it:
javac sun.java
It compiles successfully then i have to run it
java A
The output is: Hai
This part is completed. Now i ll go to the next program
File name:moon.java
Then the code is here:
Class A
{
public static void main(String args[])
{
System.out.println("Hello");
}
}
Then i have to compile it:
javac moon.java
It compiles successfully then i have to run it
java A
Now the output is: Hello
Now i want to get the result as "Hai", so i run the file named as sun.java.
But this time again i got the result as "Hello"
What is the reason for this type of happening? and what is the solution for this problem? and how will i get the output "Hai"?
Please any one help me ASAP....
Thanks!!!