Simple question : Why is it working like this
class MyCode {
    public static void main(String[] args) {
        System.out.println("This will be printed");
    }
}
but not like this
public class MyCode {
    public static void main(String[] args) {
        System.out.println("This will be printed");
    }
}
giving this error
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at MyCode.main(worksheet.java:2)