0% found this document useful (0 votes)
13 views2 pages

Java Interview Revision Notes

The document provides a quick revision guide for Java interviews covering core concepts such as Java basics, OOP principles, keywords, exception handling, collections framework, multithreading, memory management, Java 8 features, string handling, and JDBC basics. It also includes common interview questions and answers related to Java security, string immutability, and multiple inheritance. Each section highlights essential information and key points relevant for Java programming and interviews.

Uploaded by

akbabu656
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)
13 views2 pages

Java Interview Revision Notes

The document provides a quick revision guide for Java interviews covering core concepts such as Java basics, OOP principles, keywords, exception handling, collections framework, multithreading, memory management, Java 8 features, string handling, and JDBC basics. It also includes common interview questions and answers related to Java security, string immutability, and multiple inheritance. Each section highlights essential information and key points relevant for Java programming and interviews.

Uploaded by

akbabu656
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

Java Interview Quick Revision (PDF)

1. Core Java Basics


• Java is platform-independent due to JVM (Write Once, Run Anywhere).
• JDK = JRE + Development Tools, JRE = JVM + Libraries.
• Main method: public static void main(String[] args).

2. OOP Concepts
• Encapsulation: Data hiding using private variables and public getters/setters.
• Inheritance: extends keyword, supports reusability.
• Polymorphism: Method overloading (compile-time), overriding (runtime).
• Abstraction: abstract class & interface.
• Interface supports multiple inheritance, variables are public static final by default.

3. Keywords
• final: prevents modification.
• static: belongs to class.
• this: refers to current object.
• super: refers to parent class object.
• transient: ignored during serialization.
• volatile: ensures visibility across threads.

4. Exception Handling
• Checked: IOException, SQLException (compile-time).
• Unchecked: NullPointerException, ArrayIndexOutOfBoundsException.
• try-catch-finally used to handle exceptions.
• throw vs throws: throw explicitly throws exception, throws declares it.

5. Collections Framework
• List: ArrayList, LinkedList (allows duplicates).
• Set: HashSet, TreeSet (no duplicates).
• Map: HashMap, TreeMap (key-value).
• HashMap allows one null key, HashTable allows none.
• ArrayList is faster than LinkedList for search.

6. Comparable vs Comparator
• Comparable: compareTo(), natural ordering.
• Comparator: compare(), custom ordering.

7. Multithreading
• Thread created by extending Thread class or implementing Runnable.
• start() creates new thread, run() executes code.
• Synchronization avoids race condition.
• Deadlock occurs when threads wait indefinitely.
8. Java Memory
• Stack: method calls, local variables.
• Heap: objects and instance variables.
• Garbage Collector cleans unused objects automatically.

9. Java 8 Features
• Lambda expressions.
• Stream API.
• Functional Interfaces (only one abstract method).
• Optional class avoids NullPointerException.

10. String
• String is immutable.
• StringBuilder is mutable & faster than StringBuffer.
• equals() checks content, == checks reference.

11. JDBC Basics


• Steps: Load Driver → Create Connection → Create Statement → Execute Query → Close.
• PreparedStatement prevents SQL Injection.

12. Common Interview One-Liners


• Why Java is secure? → Bytecode, JVM, No pointers.
• Why String is immutable? → Security & performance.
• Why multiple inheritance not supported? → Avoid ambiguity.

You might also like