0% found this document useful (0 votes)
314 views10 pages

Topic Wise Java Interview Questions

Java interview questions for a freshers.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
314 views10 pages

Topic Wise Java Interview Questions

Java interview questions for a freshers.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 10

Topic Wise Java Interview Questions

Basic Questions
1. What is Java? Why it is Object Oriented
2. What is JDK?
3. What is JVM?
4. What are the Features of Java?
5. What are Identifiers?
6. What are Variables, Keywords.
7. What is Oops.
8. What is SingleTon Class.
9. How many members are present in the blank class?
10. Is Java completely object-oriented?
11. what are objects and how to create
12. explain string memory management.
13. difference between a constant pool and a non-constant pool.

PolyMorphism
1. What is the difference b/w compile time polymorphism and Run time
polymorphism?
2. What is Run Time Polymorphism?
3. Can you achieve run time polymorphism by Data Members?
4. what is the difference between static binding and dynamic binding?
5. what is the Java instance operator?
Abstraction
1. What is the abstraction?
2. What is the abstract class?
3. Can there be an abstract method without an abstract class?
4. Can you use abstract and final both with a method.
5. Is it possible to instantiate the abstract class?
6. What is the interface?
7. Can you declare an interface method static?
8. Can the interface be final?
9. What is a marker interface?
10. What is the difference between abstract class and interface?
11. Can we define private and protected modifiers for the members in the
interface?
12. When can an object reference be cast to an interface reference?
13. Can we make the abstract class final?
14. Can we create a constructor for the abstract class?
15. How to invoke abstract class constructors.
16. Can we overload abstract methods?
17. Can we override abstract methods?
18. Can we achieve multiple inheritance using java?
19. Will the abstract class inherit the object class?
20. How to achieve abstraction.
21. What is the outcome of abstraction?
Encapsulation

1. What is Encapsulation?
2. How to achieve Encapsulation.
3. Explain Java Bean Class.
4. Explain Java bean Encapsulation.
5. How to make a read-only class in Java.
6. How to make a write-only class in Java.
7. What are the advantages of encapsulation in Java?

Packages

1. What are the Packages?


2. What are the advantages of defining packages in Java?
3. How to create packages in Java.
4. How can we access some class in another class in Java?
5. Do I need to import the Java lang package at any time? why.
6. Can I import the same packages/class twice? will the JVM load the package
twice at runtime?
7. What is static import.

Exception Handling

1. What is an exception?
2. What is exception handling?
3. In how many ways we can handle exceptions?
4. How many types of exceptions are there?
5. What is a checked exception?
6. What is an unchecked exception?
7. Can we write more than one catch for a single try block?
8. What is a generalized catch block
9. What is written within try block
10. What is written within a catch block
11. What is finally block
12. Can we write finally block without catch block
13. Explain the hierarchy of Java Exception classes.
14. What is the difference between a Checked Exception and an Unchecked
Exception?
15. What is the base class for Error and Exception?
16. Is it necessary that each try block must be followed by a catch block?
17. Is there any case when finally will not be executed?
18. What is the throw keyword?
19. What are throws?
20. What is the difference between throws and throws?
21. Can an exception be rethrown?
22. Can the subclass overriding method declare an exception if the parent class
method doesn't throw an exception?
23. What is exception propagation?
24. difference between throw, throws, and throwable.
25. Difference between final, finally and final
Inheritance.

1. What is this keyword in Java?


2. What are the main uses of this keyword?
3. Can we assign the reference to this variable? 4. Can this keyword be used to
refer to static members?
5. How can constructor chaining be done using this()?
6. What is the Inheritance?
7. Why is Inheritance used in Java?
8. Which class is the superclass for all the classes? 9. Why is multiple
inheritance not supported in Java?
10. What is super in Java?
11. How can constructor chaining be done by using the super()?
12. What are the main uses of the super keyword?
13. What are the differences between this and the super keyword?
14. Can you use this() and super() both in a constructor?
15. What is object cloning?
16. what is this keyword and super keyword in java?
17. can we make constructors private
18. what is inner class?
19. what is built in class?
20. how to achieve multiple inheritance in Java.
Method-Overriding

1. What is method overriding?


2. Can we override the static method?
3. Why can we not override the static method? 4. Can we override the
overloaded method?
5. Difference between method Overloading and Overriding.
6. Can we override the private methods?
7. Can we change the scope of the overridden method in the subclass?
8. Can we modify the throws clause of the superclass method while overriding
it in the subclass?
9. Can you have virtual functions in Java?

final keyword

1. What is the final variable?


2. What is the final method?
3. What is the final class?
4. What is the final blank variable?
5. Can we initialize the final blank variable?
6. Can you declare the main method as final?
7. Can we declare a constructor as final?
8. Can we declare an interface as final?
9. What is the difference between the final method and the abstract method?
Method-Overriding

1. What is method overriding?


2. Can we override the static method?
3. Why can we not override the static method? 4. Can we override the
overloaded method?
5. Difference between method Overloading and Overriding.
6. Can we override the private methods?
7. Can we change the scope of the overridden method in the subclass?
8. Can we modify the throws clause of the superclass method while overriding
it in the subclass?
9. Can you have virtual functions in Java?

Collections
{Basic Concepts}

1. What are collections in Java?


2. What is the difference between a Collection and Collections in Java?
3. What are the main interfaces in the Java Collections Framework?
4. What are the differences between List, Set, and Map interfaces?
5. How do you create a List, Set, and Map in Java?
6. What are the differences between ArrayList and LinkedList?
7. What is the difference between HashSet and TreeSet?
8. What is the difference between HashMap and TreeMap?
9. What is the difference between Hashtable and HashMap?
10. What is the difference between Comparable and Comparator in Java?
Collection Classes

1. What are the main classes that implement the List interface?
2. What are the main classes that implement the Set interface?
3. What are the main classes that implement the Map interface?
4. How does ArrayList differ from Vector?
5. How does LinkedHashSet differ from HashSet?
6. What is a PriorityQueue? How does it differ from other queues?
7. What is a ConcurrentHashMap and how does it differ from a HashMap?
8. What is an EnumSet and when would you use it?
9. What is a WeakHashMap and when would you use it?
10. What is an IdentityHashMap and when would you use it?

Iterators and Streams

1. What is an Iterator in Java and how do you use it?


2. What is a ListIterator and how is it different from an Iterator?
3. What is the forEach method in Java 8?
4. What are the differences between internal and external iteration?
5. What are Streams in Java and how do they relate to collections?
6. How do you filter, map, and reduce collections using Streams?
7. What are the advantages of using Streams over traditional loops?
Performance and Efficiency
1. How do you measure the performance of different collection
implementations?
2. When should you use an ArrayList over a LinkedList?
3. When should you use a HashSet over a TreeSet?
4. What are the performance implications of using a HashMap vs. a TreeMap?
5. How does the performance of synchronized collections compare to
concurrent collections?
6. What are the best practices for choosing the right collection for a given use
case?

Advanced Topics

1. What are the new collection factory methods introduced in Java 9?


2. How does the Copy On Write Array List work and when would you use it?
3. What is the Navigable Set interface and which classes implement it?
4. What is the Navigable Map interface and which classes implement it?
5. How do you use Collections synchronized List and Collections? Synchronized
Map?
6. How do you use Collections? unmodifiable List and Collections.unmodifiable
Map?
7. What is the Deque interface and how is it different from a Queue?
8. What are the differences between Blocking Queue and Concurrent Linked
Queue?
9. What is a BitSet and how is it used in Java?
Practical Usage
1. How do you sort a list of custom objects in Java?
2. How do you remove duplicates from a list in Java?
3. How do you merge two lists in Java?
4. How do you convert a list to a set and vice versa?
5. How do you convert a map to a list of key-value pairs and vice versa?
6. How do you find the intersection of two sets in Java?
7. How do you iterate over a map in Java?
8. How do you implement a custom collection in Java?

Difference Betweens in Collections

1. What is the difference between Collection and Collections in Java?


2. What are the differences between List, Set, and Map interfaces?
3. What is the difference between ArrayList and LinkedList?
4. What is the difference between HashSet and TreeSet?
5. What is the difference between HashMap and TreeMap?
6. What is the difference between Hashtable and HashMap?
7. What is the difference between Comparable and Comparator in Java?
8. What is the difference between ArrayList and Vector?
9. What is the difference between LinkedHashSet and HashSet?
10. What is the difference between PriorityQueue and other queues?
11. What is the difference between ConcurrentHashMap and HashMap?
12. What is the difference between EnumSet and other Set implementations?
13. What is the difference between WeakHashMap and HashMap?
14. What is the difference between IdentityHashMap and HashMap?

You might also like