Core Java Revision Notes
Comprehensive 60–70 Page Revision Guide
Java Basics
Java is a high-level, object-oriented programming language. It is platform-independent due to JVM.
Core components: JDK (development kit), JRE (runtime), JVM (machine).
Hello World Example
Every Java program must have a class definition and a main method.
class HelloWorld { public static void main(String[] args) {
[Link]("Hello, World!"); } }
Data Types
Java has 8 primitive data types: byte, short, int, long, float, double, char, boolean. They are stored
in stack memory, while objects are stored in heap.
Classes and Objects
Java is object-oriented. Objects are instances of classes. A class defines state (variables) and
behavior (methods).
class Student { String name; int age; void display() { [Link](name
+ " " + age); } } public class Main { public static void main(String[] args) {
Student s = new Student(); [Link] = "John"; [Link] = 21; [Link](); } }
Inheritance
Inheritance allows one class to acquire properties of another using the 'extends' keyword. It
supports reusability and method overriding.
class Animal { void sound() { [Link]("Animal sound"); } } class Dog
extends Animal { void sound() { [Link]("Dog barks"); } }
Polymorphism
Two types: Compile-time (method overloading) and Runtime (method overriding). It allows multiple
forms of the same method.
class Calculator { int add(int a, int b) { return a+b; } double add(double a,
double b) { return a+b; } }
Exception Handling
Java uses try-catch-finally blocks. Exceptions can be checked or unchecked. Custom exceptions
can be created by extending Exception class.
try { int x = 10/0; } catch (ArithmeticException e) {
[Link]("Error: " + e); } finally { [Link]("Cleanup
code."); }
Collections Framework
Provides data structures like List, Set, Map, Queue. They are part of [Link] package.
import [Link].*; class Example { public static void main(String[] args) {
List list = new ArrayList<>(); [Link]("A"); [Link]("B");
[Link](list); } }
Multithreading
Threads allow concurrent execution. Created by extending Thread or implementing Runnable.
class MyThread extends Thread { public void run() { [Link]("Thread
running..."); } } public class Main { public static void main(String[] args) {
MyThread t = new MyThread(); [Link](); } }
Java 8 Features
Includes Lambda expressions, Streams, Functional Interfaces, Default & Static methods in
interfaces.
import [Link].*; class Main { public static void main(String[] args) { List
nums = [Link](1,2,3); [Link](n -> [Link](n)); } }
End of Core Java Revision Notes
These notes are condensed for quick revision. Recommended for interviews, exams, and brushing
up Java concepts.