Could anyone please explain to me the concept of why is it absolutely necessary to save the Java program with the name of the public class defined in it?
Saving the following program with a name other than Pattern.java
causes an error. Why?
public class Pattern
{
public static void main(String Args[])
{
}
}
Saved as: "Ex.java" Error: class Pattern is public, should be declared in a file named Pattern.java public class Pattern