1.
Java Basics
Java is a platform-independent, object-oriented programming language. It follows WORA (Write
Once Run Anywhere).
Execution Steps: .java -> compiled by javac -> .class -> executed by JVM.
Code:
class Hello { public static void main(String args[]) { [Link]('Hello Java'); } }
Explanation: class defines program, main() is entry point, println prints output.
2. OOP Concepts
Inheritance allows reuse. Overloading = same method different parameters. Overriding = redefining
parent method.
Code:
class A { void show(){ [Link]('A'); } } class B extends A { void show(){
[Link]('B'); } }
Explanation: B overrides method of A.
3. Keywords
static: shared, final: constant, this: current object, super: parent, throw/throws for exceptions.
4. Exception Handling
Used to handle runtime errors.
Code: try{ int a=10/0; } catch(Exception e){ [Link](e); }
Explanation: division by zero caught in catch block.
5. Anonymous Inner Class
Class without name used for one-time implementation.
6. Multithreading
Allows parallel execution. Life cycle: New -> Runnable -> Running -> Dead.
Code: class T extends Thread { public void run(){ [Link]('Thread'); } }
7. Collections
Framework to store objects. ArrayList, Set, Map.
Code: ArrayList list = new ArrayList<>(); [Link](10);
8. Strings
String immutable, StringBuffer mutable.
Code: String s='Hello'; StringBuffer sb=new StringBuffer('Hi');
9. AWT/Swing
Used for GUI programming and event handling.
10. Packages
Used to group classes and avoid naming conflicts.
11. JDBC
Used to connect Java with database.
Steps: Load driver, connect, create statement, execute query.
12. File Handling
Used to read/write files.
Code: BufferedReader br=new BufferedReader(new FileReader('[Link]'));
13. Reflection API
Used to inspect classes at runtime.
14. Core Concepts
JIT improves performance, Functional Interface has one method, MVC separates logic, Sandbox
ensures security.