Java Important Short Notes
OOP Concepts
Object Oriented Programming is a programming approach based on objects and classes. Its main features are
encapsulation, inheritance, polymorphism, and abstraction which help in code reusability and security.
JVM / JDK / JRE
JVM (Java Virtual Machine) executes Java bytecode on any platform. JRE (Java Runtime Environment) provides
libraries and JVM to run Java programs. JDK (Java Development Kit) contains JRE along with development tools like
compiler and debugger.
Class & Object
A class is a blueprint that defines data members and methods. An object is a real instance of a class used to access
properties and behaviors defined in the class.
Constructor
A constructor is a special method that is automatically called when an object is created. It is mainly used for initializing
object values and has the same name as the class.
Inheritance
Inheritance allows one class to acquire properties and methods of another class. It improves code reusability and
supports hierarchical relationships between classes.
Polymorphism
Polymorphism means one entity can perform multiple forms of behavior. In Java it is mainly achieved using method
overloading and method overriding.
Exception Handling
Exception handling is a mechanism used to handle runtime errors and maintain normal program flow. Java uses try,
catch, finally, throw, and throws keywords for exception handling.
Arrays
An array is a collection of elements of the same data type stored in contiguous memory locations. Arrays are used to
store multiple values using a single variable name.
Strings
Strings in Java are objects used to store sequences of characters. The String class provides many methods such as
length(), substring(), and compareTo() for string manipulation.
Interfaces & Abstraction
Abstraction hides implementation details and only shows important functionality to the user. Interfaces are used to
achieve complete abstraction and support multiple inheritance in Java.
Overloading vs Overriding
Method overloading means defining multiple methods with the same name but different parameters in the same class.
Method overriding means redefining a parent class method in the child class with the same signature.