Below are some important Core Java interview questions which are asked in most MNC company interviews for beginners or professionals.
16. What is the return type of the main method?
Main method doesn't return anything hence declared void.
17. Why is the main method declared static?
main method is called by the JVM even before the instantiation of the class hence it is declared as static.
18. What is the arguement of main method?
main method accepts an array of String object as arguement.
19. Can a main method be overloaded?
Yes. You can have any number of main methods with different method signature and implementation in the class.
20. Can a main method be declared final?
Yes. Any inheriting class will not be able to have it's own default main method.
16. What is the return type of the main method?
Main method doesn't return anything hence declared void.
17. Why is the main method declared static?
main method is called by the JVM even before the instantiation of the class hence it is declared as static.
18. What is the arguement of main method?
main method accepts an array of String object as arguement.
19. Can a main method be overloaded?
Yes. You can have any number of main methods with different method signature and implementation in the class.
20. Can a main method be declared final?
Yes. Any inheriting class will not be able to have it's own default main method.
No comments:
Post a Comment