What happens when a main method is declared as private?

Answer Posted / milanjeet singh

When we define main method as private, it will compile but when run, it show an Error as: main method is not found in the class, please define the main method as public static void main (String[] args)

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a constructor call the constructor of parent class?

532


Is list ordered in java?

536


What is ‘has a’’ relationship in java?

720


Where and how can you use a private constructor?

530


Why are data types important?

531






When we should use serialization?

560


What is the use of default method in interface in java? Explain

541


How many types of string data types are there?

551


What are three ways in which a thread can enter the waiting state in java programming?

678


What is join () in java?

524


what is the role of xml in core java?? and how we can use it?? can somebody give a sample program with explanation and from where i can read more about xml?????

1795


What is the ==?

461


What is empty string literal in java?

555


Explain aggregation in java?

543


What are the 7 types of characters?

562