Can we declare the main method of our class as private?
Yes, we can! it will compile, but it will not run. In Java we declare the main method of our class as private, it compiles without errors, but it can not be taken as the entry point of your application. When you compile your application it will compile without any error, but at runtime, it throws an exception the main method is not public. On the basis of the above discussion, we reached the conclusion that's you can declare the main method as private but at runtime, it says the main method is not public.
I hope it's informative for you...