What happens when a main method is declared as private?

Answer Posted / dharma

main method signature must be like

public static void main(String args[])

if we declare as private then it compiles successfully

but at Runtime it says

"Main method not found in class"

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is singleton instance static?

503


Is 0 an even number?

541


What is r in java?

589


In which order the iterator iterates over collection?

575


What are kinds of processors?

561






What is difference between Heap and Stack Memory?

530


What is a subsequence of a string?

541


Can you override static methods?

500


Can we restart a dead thread in java?

546


How do you get length in java?

552


What is void data type?

568


What is the difference between compare and compareto in java?

489


What is the significance of java packages?

609


How can we find the sum of two linked lists using stack in java?

563


Why do people says “java is robust”?

549