Subscribe to Youtube and Telegram Channel for Regular Updates
|Python for Beginners Video tutorial|
|Big Data Analytics Video Tutorial||Placement Video Tutorial|
Core Java Interview Questions and Answers: Question 11 to Question 20
Here you can find the most important top) core java interview questions and answers (11 to 20) for placement (campus) interview and competitive examinations.
11. What is difference between Path and Classpath?
Answer: Path and Classpath are operating system level environment variales. The path is used to define where the system can find the executables(.exe) files and classpath is used to specify the location .class files.
12. What are local variables?
Answer: Local variables are those which are declared within a block of code like methods. Local variables should be initialized before accessing them.
13. What are the instance variables?
Answer: Instance variables are those which are defined at the class level. Instance variables need not be initialized before using them as they are automatically initialized to their default values.
14. How to define a constant variable in Java?
Answer: The variable should be declared as static and final. So only one copy of the variable exists for all instances of the class and the value can’t be changed also. static final int PI = 3.14; is an example for constant.
15. Should a main() method be compulsorily declared in all java classes?
Answer: No not required. the main() method should be defined only if the source class is a java application.
16. What is the return type of the main() method?
Answer: Main() method doesn’t return anything hence declared void.
17. Why is the main() method declared static?
Answer: main() method is called by the JVM even before the instantiation of the class hence it is declared as static.
18. What is the argument of main() method?
Answer: main() method accepts an array of String object as arguement.
19. Can a main() method be overloaded?
Answer: Yes. You can have any number of main() methods with the different method signature and implementation in the class.
20. Can a main() method be declared final?
Answer: Yes. Any inheriting class will not be able to have it’s own default main() method.
Here you can find the frequently asked Core Java Interview Questions and Answers 11 to 20. If you like the material share it with your friends. Like the Facebook page for regular updates and YouTube channel for video tutorials.