← Back to list

Explain briefly about POJO in Java?

POJO is Plain old java object. The class with its private attributes and the having the getter and setter method. these methods are public…

Pankaj Sonagara · 2024-04-09 09:43 · 0 claps · 0.5 min read
#java #pojo #plain-old-java-object #java-class #objects
Open on Medium ↗

Explain briefly about POJO in Java?

POJO is Plain old java object. The class with its private attributes and the having the getter and setter method. these methods are public so any class from out side can access this attributes via the methods only not directly.

import java.util.Date;

public class Student {

 private int id;
 private String name;
 private Date dob;

 public Date getDob() {
  return dob;
 }

 public void setDob(Date dob) {
  this.dob = dob;
 }

 public int getId() {
  return id;
 }

 public void setId(int id) {
  this.id = id;
 }

 public String getName() {
  return name;
 }

 public void setName(String name) {
  this.name = name;
 }
}

Here you can see the Student class POJO with id , name and DOB attributes and having the getter and setter methods.


메타데이터
post_id
efd0b0d99ed5
slug
explain-briefly-about-pojo-in-java-efd0b0d99ed5
url
https://medium.com/@er.pankajsonagara/explain-briefly-about-pojo-in-java-efd0b0d99ed5
canonical_url
https://medium.com/@er.pankajsonagara/explain-briefly-about-pojo-in-java-efd0b0d99ed5
author_url
https://medium.com/@er.pankajsonagara
status
ok
fetched_at
2026-08-18 04:47:05