Core Java Interview Questions

Q. What if the main method is declared as private?

Answer:

The program compiles properly but at runtime it will give “Main method not public.” message.

Q. What is meant by pass by reference and pass by value in Java?

Answer:

Pass by reference means, passing the address itself rather than passing the value. Pass by value means passing a copy of the value.


Source : http://www.javacodegeeks.com/2013/09/core-java-interview-questions.html

Back to Top