Java OOP Concepts Summary
Prepared by ChatGPT
Is Java a Pure OOP Language?
• Java is NOT a pure OOP language because:
• • It supports primitive data types.
• • Uses static methods/variables.
• • Allows procedural programming.
• • Does not support full operator overloading.
Wrapper Classes in Java
• Needs of Wrapper Classes:
• • Convert primitives to objects
(Boxing/Unboxing).
• • Required for Collections (ArrayList,
HashMap).
• • Provide utility methods.
• • Needed for Serialization & Reflection.
Eight Wrapper Classes
• Wrapper Classes:
• • Byte, Short, Integer, Long
• • Float, Double
• • Character
• • Boolean
Why Wrapper Classes Are Final?
• Reasons:
• • To maintain immutability.
• • Enables caching (e.g., Integer cache).
• • Ensures security & consistent behavior.
String Immutability
• String is immutable because:
• • Its value cannot change after creation.
• • New object created for every modification.
Why Immutability Improves
Performance?
• Performance Benefits:
• • Enables String Pool (memory saving).
• • Safe for multithreading.
• • Faster hashing (used in HashMap).