Can we use more than one public class in a java file
Answer to this question is No. We can not have more than one public classes inside one source file. And also your source file name should match exactly with public class inside your file. On other side you can have any number of default access classes inside same source file.
we can't try protected as non-nested class
protected is not allowed as access modifier for non inner classes, only public and default are allowed.