What happens when a main method is declared as private?

Answer Posted / chinmay

If main method declared as private then at compilation no problem but at run time it shows an error that main method should be public...
because we access the main() method out side from class if it is private then it cannot be accessible...
that's why we have to write public in main method signature...

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is singleton class immutable?

530


Does A Class Inherit The Constructors Of Its Superclass?

530


what is object-oriented programming in java?

581


When is the finalize() called?

687


Is java call by value?

577






What is string substring?

554


Is int primitive data type?

501


What is the purpose of stub and skeleton?

536


What is the public field modifier?

538


What is meant by javabeans?

607


What is a platform?

534


Are arrays classes in java?

524


Does java list allow null?

532


What is the locale class in java programming?

525


Give any two differences between C++ and java.

552