Questions TopicWise JAVA
OOPs
Q.1 What do you mean by Inheritance ? What are the
advantages of Inheritance ?
Q.2 Which class is by default parent class of all java classes ?
why ?
Q.3 How many types of Inheritance are possible explain each
and which type of Inheritance not supported in java ?
Q.4 What do you mean by multiple Inheritance ?
Q.5 Why java doesn’t support multiple inheritance?
Q.6 What is an ambiguity problem or diamond problem
regarding inheritance in java ?
Q.7 Why does the ambiguity problem not arise in the case of
interfaces in java ?
Q.8 What do you mean by a HAS-A relationship ?
Q.9 What do you mean by composition and aggregation in
JAVA ?
Q.10 Give practical example of composition and aggregation in
JAVA ?
Q. 11 What do you mean by method signature ?
Q.12 What do you mean by method overloading ?
Q. 13 What do you mean by method overriding ?
Q. 14 What do you mean by method hiding ?
Q. 15 Explain the differences between method overriding and
method hiding in java ?
Q. 16 Explain the differences between method overloading and
method overriding in java ?
Q. 17 What do you mean by polymorphism ? How many types
of polymorphism are there ?
Q.20 What is the main purpose of the Constructor ?
Q. 23 What do you mean by default constructor ?
Q. 24 What are the differences between super(), this() and
super,this ?
Q. 26 What do you mean by object type casting ?
Q. 27 Explain rules for object type casting ?
Q.28 What do you mean by Data hiding, Abstraction,
Encapsulation in Java ?
Q.29 What is the purpose of the static block ?
Q.30 What is the purpose of the instance block ?
Q.31 What do you mean by coupling ?
Q.32 What do you mean by Cohesion ?
Language Fundamentals
Q.1 What do you mean by Identifiers ?
Q.2 Explain Rules of Java Identifiers ?
Q.3 Difference between float and double data type ?
Q.4 Why char data types takes 2 byte of memory in java ?
Q.5 What are the advantages and disadvantages of array ?
Q.7 What are the differences between instance and static
variables ?
Q.8 What do you mean by the var-arg method ?
Q.9 What are the advantages of the var-arg method ?
Q.10 What changes can we perform on main() ?
Q.12 What do you mean by command line arguments ?
Exception Handling
Q.1 What do you mean by exception ?
Q.2 What is the main objective of Exception Handling ?
Q.3 What is the meaning of Exception Handling ?
Q.5 Which is the root class for Java Exception Hierarchy and
why ?
Q.6 What are the differences between checked exceptions &
unchecked exceptions ?
Q.7 What are the differences between partially checked
exceptions & fully checked exceptions ?
Q.8 What is the purpose of try and catch block ?
Q.9 Explain about methods to print exception information to
the console ?
Q.10 What is the main purpose of try with multiple catch
blocks ?
Q.11 What is the main purpose and speciality of finally block ?
Q.13 What is the purpose of the throw keyword ?
Q.14 What is the purpose of the throws keyword ?
Q.15 How many types of exceptions are available in java ?
Q.16 Explain any 5 exceptions of java ?
Declaration & Access Modifiers
Q.1 How many classes a java program can contain ?
Q.2 What do you mean by fully qualified name and what is the
problem in using a fully qualified name ?
Q.3 What is the purpose of import ?
Q.4 Explain types of import statement ?
Q.6 What do you mean by static import ?
Q. 7 What are the advantages and disadvantages of using
static import ?
Q.8 What do you mean by package ?
Q.9 What do you mean by public modifier ?
Q.10 What do you mean by private modifier ?
Q.11 What do you mean by <default> modifier ?
Q.12 What do you mean by protected modifier ?
Q.13 What do you mean by final modifier ?
Q.14 Explain abstract class and abstract method ?
Q.15 What is the purpose of strictfp modifier ?
Q.16 What is the purpose of native modifier ?
Q.17 How many modifiers are applicable on outer class ?
Q.18 Which modifiers are applicable for local variables ?
Q.19 Which modifiers are applicable only for method ?
Q.20 Which modifiers are applicable only for variables ?
Q.21 On Constructors which modifiers are applicable?
Interface
Q.1 What do you mean by interface ?
Q.2 Explain about extends and implements keywords ?
Q.3 What is the purpose of import ?
Q.4 Explain about interface methods and interface variables ?
Q.5 Multiple Inheritance possible in java or not ?
Q.6 Why is multiple Inheritance not supported in classes but
supported in Interfaces ?
Q.7 How many Interfaces a Java class can implement
simultaneously ?
Q.8 What do you mean by marker Interface ?
Q.9 What do you mean by Adapter class ?
Q.10 What are the differences between abstract class &
Interface ?
Q.11 What do you mean by default method in Interface ?
Q.12 What do you mean by static method in Interface ?
Java.lang package
Q.1 Explain about Object class?
Q.2 Explain about toString() ?
Q.3 What do you mean by hashCode ?
Q.4 Explain about equals() ?
Q.5 Explain the relation between == operator and equals() ?
Q.6 What are the differences between == operator and equals()
?
Q.7 What is the purpose of cloning ?
Q.8 What are the differences between shallow cloning and
deep cloning ?
Q.9 What are the differences between String and StringBuffer ?
Q.10 Why is the String class object immutable ?
Q.11 What are the advantages and disadvantages of scp ?
Q.12 What are the differences between equals() and
equalsIgnoreCase() ?
Q.13 What are the differences between StringBuffer and
StringBuilder ?
Q.14 What do you mean by wrapper classes ?
Q.15 Which wrapper classes are not direct child classes of the
Object class ?
Q.16 Which wrapper classes are direct child classes of the
Object class ?
Q.17 What do you mean by auto boxing & auto unboxing ?
Garbage Collection
Q.1 What do you mean by Garbage Collection ?
Q.2 When an object is said to be eligible for GC ?
Q.3 Explain ways to make an object eligible for GC ?
Q.4 How can we request JVM to run GC ?
Q.5 Explain the purpose of finalize() ?
Q.6 What do you mean by memory leaks ?
Collection Framework
Q.1 What are the advantages and disadvantages of array ?
Q.2 What are the advantages of collection ?
Q.3 What are the differences between array & collection ?
Q.4 What are the differences between add() and addAll()
method of Collection interface ?
Q.5 What is the purpose of retainAll() of Collection interface ?
Q.6 What are the differences between contains() and
containsAll() method of Collection interface ?
Q.7 What are the differences between Collection & Collections
?
Q.8 Explain the properties of ArrayList ?
Q.9 What is the relation between current capacity & new
capacity of ArrayList ?
Q.10 What are the differences between ArrayList & Vector ?
Q.11 When ArrayList is the best choice ?
Q.12 Explain the properties of LinkedList ?
Q.13 When LinkedList is the best choice ?
Q.14 Explain the properties of Vector ?
Q.15 Explain the properties of Stack ?
Q.16 What are the differences between pop() and peek() of
Stack class ?
Q.17 What do you mean by cursors & how many cursors are
available in Java ?
Q.18 Explain the properties of the Enumeration cursor ?
Q.19 What are the limitations of the Enumeration cursor ?
Q.20 Explain the properties of the Iterator cursor ?
Q.21 What are the limitations of the Iterator cursor ?
Q.22 Explain the properties of the Listterator cursor ?
Q.23 What are the limitations of the ListIterator cursor ?
Q.24 What are the differences among all the 3 cursors ?
Q.25 Explain the properties of HashSet ?
Q.27 What are the differences between HashSet &
LinkedHashSet ?
Q.28 Explain the properties of TreeSet ?
Q.29 What are the differences between Comparable &
Comparator ?
Q.30 What is the purpose of the Map interface ?
Q.32 Explain the properties of HashMap ?
Q.33 What are the differences between HashMap & Hashtable ?
Q.34 What are the differences between HashMap &
LinkedHashMap ?
Q.35 What are the differences between HashMap &
IdentityHashMap ?
Q.36 What are the differences between HashMap &
WeakHashMap ?
Q.37 Explain the properties of TreeMap ?
Q.38 What is the main purpose of Generics ?
Q.39 What are the differences between ArrayList l=new
ArrayList() and ArrayList<String> l=new ArrayList<String>() ?
Multi-Threading
Q.1 What do you mean by Multi-Tasking ?
Q.2 What are the differences between process based
multitasking and thread based multitasking ?
Q.3 By How many ways can we create a Thread in Java ?
Q.4 What do you mean by Thread Scheduler ?
Q.5 What are the differences between t.start() & t.run() ?
Q.6 What is the importance of Thread class start() ?
Q.9 Explain Thread life cycle in Java ?
Q.10 How can we set and get the name of a thread in Java ?
Q.11 How can we get current executing thread object in Java ?
Q.12 What do you mean by Thread Priority In Java ?
Q.13 Explain the concept of default priority ?
Q.14 Explain the purpose of yield() ?
Q.15 Explain the purpose of join() ?
Q.16 Explain the purpose of sleep() ?
Q.17 What do you mean by synchronization ?
Q.18 What are the advantages & disadvantages of
synchronization ?
Q.19 What do you mean by object level lock ?
Q.21 What is the purpose of synchronized block ?
Q.22 What do you mean by daemon thread ?
Q.23 What is the default daemon nature ?
Q.24 What do you mean by Inter Thread Communication ?
Q.25 What is the difference between notify() and notifyAll() ?
Q.26 What do you mean by deadlock ?
Q.27 What are the differences between deadlock & starvation ?