JAVA Interview Questions
JAVA Interview Questions
3 . What is bytecode?
Strings
23 . What is a class?
24 . What is an object?
30 . What are the important things to consider when implementing equals method?
35 . Can super class reference variable can hold an object of sub class?
37 . What is an interface?
47 . What is a constructor?
54 . Is a super class constructor called even when there is no explicit call from a sub
class constructor?
55 . What is polymorphism?
57 . What is coupling?
58 . What is cohesion?
59 . What is encapsulation?
Modifiers
69 . What access types of variables can be accessed from a class in same package?
70 . What access types of variables can be accessed from a class in different package?
71 . What access types of variables can be accessed from a sub class in same package?
72 . What access types of variables can be accessed from a sub class in different
package?
86 . Guess the output of this for loop (P.S. there is an error as the output of given
question should be 0-1-2-3-4-5-6-7-8-9. So please ignore that.)
Exception handling
100 . What is the difference between checked exceptions and unchecked exceptions?
102 . What happens when you throw a checked exception from a method?
103 . What are the options you have to eliminate compilation errors when handling
checked exceptions?
Miscellaneous topics
110 . How do you loop around an array using enhanced for loop?
133 . Are the values of static variables stored when an object is serialized?
Multi threading
191 . What is priority of a thread? How do you change the priority of a thread?
203 . What are the important methods in Java for inter-thread communication?
207 . Can you write a synchronized program with wait and notify methods?