Java Classes Part 2
2 min readFeb 6, 2025
Final Class :-
Get SIDDHARTH SHARMA’s stories in your inbox
Join Medium for free to get updates from this writer.
Final Class Cannot be inherit by Another Class.
Press enter or click to view image in full size![]()
Press enter or click to view image in full size![]()
Pojo Class:-
- Pojo stands for Plain old Java Objects.
- a Pojo is a simple Java class that is not tied to any framework.
- A Pojo class must be public.
- It must have default constructor but can have parametrized constructor.
- Pojo class should not extend predefined classes.
- It should not implement prespecified interfaces.
- It should not have any prespecified annotation.
- example of pojos is Dtos in spring Boot and
- it can have public private and protected member and public getter and setter.
- A JavaBean is a special type of POJO that follows stricter conventions:
- It must have a no-argument constructor.
- All fields must be private.
- It must provide getter and setter methods following the naming convention (
getXxx,setXxxfor non-boolean fields, andisXxxfor boolean fields). - It should implement
Serializable(optional but common).
ENUM CLASS:-
- All member Are By default constant(static+final).
- it internally extends java.lang.ENUM class so it cannot inherit another class. Also No other class extend enum class.
- it can have constructor method but it convert constructor private in byte code so it cannot be initiated.
- it can have abstract method and all constant should override that method.







