0% found this document useful (0 votes)
5 views7 pages

Java OOP Concepts and Wrapper Classes

Uploaded by

ousmanketemaw723
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views7 pages

Java OOP Concepts and Wrapper Classes

Uploaded by

ousmanketemaw723
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

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).

You might also like