Posts

Showing posts from July, 2019

java interview questions - interview tips

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. Q. If you’re overriding the method equals() of an object, which other method you might also consider? Answer: hashCode() Q. What is Byte Code? Or Q. What gives java it’s “write once and run anywhere” nature? Answer: All Java programs are compiled into class files that contain bytecodes. These byte codes can be run in any platform and hence java is said to be platform independent. Q. Expain the reason for each keyword of public static void main(String args[])? Answer: public  – main(..) is the first method called by java environment when a program is executed so it has to a...