Core Java Quick Notes
Core Java Quick Notes
1. Features of Java
Types:
- Single
- Multilevel
- Hierarchical
- Multiple (via Interface)
- Hybrid (via Interface)
Example:
class Animal { void eat(){} }
class Dog extends Animal { void bark(){} }
Core Java Quick Notes
3. OOP Concepts
Concepts:
- Class: Blueprint for object.
- Object: Instance of a class.
- Inheritance: Acquiring features of another class.
- Polymorphism: One task, many forms.
- Abstraction: Hiding details.
- Encapsulation: Wrapping data + code in one unit.
Core Java Quick Notes
4. Constructor Types
Types:
- Default Constructor
- Parameterized Constructor
- Copy Constructor (Manual)
Example:
Student() {}
Student(int id, String name) {}
Core Java Quick Notes
5. Interface in Java
Why Use:
- Achieve multiple inheritance.
- Abstraction.
Syntax:
interface A { void show(); }
class B implements A { public void show(){} }
Core Java Quick Notes
6. Package in Java
7. Access Modifiers
9. Short Notes
Polymorphism:
- Compile-time: Overloading
- Run-time: Overriding
Overloading:
- Same class
- Different parameters
Overriding:
- Parent-child
- Same method signature
Example:
void show(int a) {} // overloading
void show(String a) {} // overloading
Operators:
- Arithmetic: +, -, *, /, %
- Relational: ==, !=, >, <
- Logical: &&, ||, !
- Assignment: =, +=, -=
- Bitwise: &, |, ^
Data Types:
- Primitive: int, float, boolean, char, etc.
- Non-Primitive: String, Arrays, Objects