I have successfully compiled this file and saved.
class A
{
public static void main(String[] args)
{
System.out.println("Hey!");
}
}
using
javac a.java
java A
but when I compile this file:
package B;
class A
{
public static void main(String[] args)
{
System.out.println("Hey!");
}
}
now, again using the same commands it do compile but never run
javac a.java
java A
// could not find or load main class
Please guide me the exact command for the terminal to run the file.
Note: The file is named "a.java".