Topic Wise Java Questions
Topic Wise Java Questions
Basics/variables/methods
1. What is JDK/JRE/JVM?
2. What is byte code file?
3. What is platform independent?
4. What is WORA principle?
5. What is keyword?
6. What is variable?
7. What happens if the variable is final?
8. Can we reassign final variables?
9. What is a method? & it's advantages.
10. Writing methods by passing/returning arguments from/to methods
11. Can we use local variable without assigning a value?
Blocks
Constructors
Method overloading
Inheritance
10. What happens if a class is declared as final? Example for final class
Packages
11. Does abstract class allows static members? If Yes, how to access them?
Write an example.
Interface
Typecasting
Method Overriding
13. While overriding, why co-variant type changes allowed & why not contra variant?
6. WAP to compare whether two mobiles are same or not w.r.t name, price & ram.
7. WAP to compare whether two cars are same or not w.r.t name, price & color.
8. WAP to compare whether two watches are same or not. Program should also
10. Explain when the objects will be created in SCP & heap memory?
14. Why do you think there are two ways of creating object of String class
Exception Handling
11. Can one try block have multiple catch blocks? If yes which catch block will
12. Can we write generalized catch block & specialized catch block together?
13. How many exceptions occur in single try block? How to handle more than one
exception?
16. Explain the difference between JVM creating an exception object & user creating
an exception object?
17. Explain exception propagation? & when exception object will propagate?
Threads
1. What is a process?
2. What is a thread?
Implementing Runnable(I)
7. How can you ensure all threads that started from main must end in
order in which they started and also main should end in last?
8. Difference between start() & run() method
15. Why wait(), notify() and notifyAll() are in Object class and not in
Thread class?
19. Difference between class level lock & object level lock?