[Go to site: main page, start]

0% found this document useful (0 votes)
6 views4 pages

Essential Java Interview Questions

Uploaded by

prajwal.may2003
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

Essential Java Interview Questions

Uploaded by

prajwal.may2003
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Basic Java interview Questions

1. What is Java? What are its main features?


2. What is JVM, JRE, and JDK?
3. Explain the difference between compiled and interpreted languages.
4. What is bytecode in Java?
5. Why is Java platform-independent?
6. What are access modifiers in Java?
7. What is the difference between == and .equals() in Java?
8. What are wrapper classes in Java?
9. What is the difference between Array and ArrayList?
10. What is autoboxing and unboxing?

1️⃣ Java Fundamentals

1. What are the data types in Java?


2. What are static variables and static methods?
3. What is the difference between local, instance, and static variables?
4. What is the main() method and why is it static?
5. What is the difference between final, finally, and finalize()?
6. What is type casting in Java?
7. What is the difference between widening and narrowing casting?
8. What are constructors in Java?
9. What is constructor overloading?
10. Can a constructor be private? Why?
11. What happens if you don’t define a constructor in a class?
12. What is a default constructor?
13. Can we overload the main() method in Java?
14. What are command-line arguments in Java?

2️⃣ OOPs Concepts (More Practical Questions)

1. What is inheritance in Java? Explain its types.


2. What is multiple inheritance? Why is it not supported directly in Java?
3. What is the difference between compile-time and runtime polymorphism?
4. What is method hiding in Java?
5. What are abstract classes and abstract methods?
6. Can we create an object of an abstract class?
7. What is an interface? How is it different from an abstract class?
8. What are default and static methods in interfaces?
9. What is encapsulation and why is it important?
10. What is the difference between aggregation and composition?

3️⃣ Strings & Memory

1. What is the difference between String, StringBuilder, and StringBuffer?


2. Why are Strings immutable in Java?
3. What is the String constant pool?
4. What is the difference between new String("Hello") and "Hello"?
5. How do you compare two strings in Java?
6. What is the output of this code?
String s1 = "Java";
String s2 = new String("Java");
[Link](s1 == s2);
[Link]([Link](s2));
7. What is intern() method in String?

4️⃣ Collections Framework (Asked Even for Freshers)

1. What is the Java Collections Framework?


2. What is the difference between List, Set, and Map?
3. What are the differences between ArrayList and LinkedList?
4. What is HashMap?
5. How does HashMap store data internally?
6. What are the differences between HashMap and Hashtable?
7. What is the difference between Iterator and ListIterator?
8. What is the difference between fail-fast and fail-safe iterators?
9. Can a HashMap have a null key?
10. What are generics in Java and why are they used?
5️⃣ Exception Handling

1. What is the difference between throw and throws?


2. What happens if an exception is not handled?
3. What are checked and unchecked exceptions?
4. Can we have multiple catch blocks in Java?
5. Can we use try without catch?
6. What is a custom exception?
7. What is the use of the finally block?

6️⃣ Multithreading (Basic Awareness for Freshers)

1. What is multithreading in Java?


2. What is the difference between process and thread?
3. What are the two ways to create threads in Java?
4. What is the difference between start() and run() method?
5. What is synchronization?
6. What is the purpose of sleep() and join() methods?
7. What is a daemon thread?

7️⃣ Java Memory Management

1. What is garbage collection in Java?


2. What is the purpose of the finalize() method?
3. When does garbage collection occur?
4. What are stack and heap memory?
5. What is the difference between shallow copy and deep copy?

8️⃣ File Handling & I/O

1. What are streams in Java?


2. Difference between byte stream and character stream?
3. What classes are used for reading and writing files in Java?
4. What is serialization and deserialization?
5. What is transient keyword in Java?
9️⃣ Keywords and Modifiers

1. What is the use of the transient keyword?


2. What is the use of the volatile keyword?
3. What is the difference between super and this?
4. Can we override a private or static method?
5. What is the purpose of instanceof operator?

Common Scenario-Based Questions

1. Can you explain what happens when we run a Java program from start to end?
2. What will happen if we remove public from the main method?
3. Can a class be both abstract and final?
4. Can we declare an interface method as private?
5. What happens if a subclass has a constructor with fewer parameters than the parent class?
6. What is the output of:
int a = 5;
int b = 10;
[Link](a + b + "Java");
[Link]("Java" + a + b);

You might also like