+ 3

What is difference between pojo class and bean class in java?

3rd Jun 2020, 3:34 AM
yash patel
yash patel - avatar
3 ответов
+ 2
A JavaBean follows certain conventions. Getter/setter naming, having a public default constructor, being serialisable etc. See JavaBeans Conventions for more details. A POJO (plain-old-Java-object) isn't rigorously defined. It's a Java object that doesn't have a requirement to implement a particular interface or derive from a particular base class, or make use of particular annotations in order to be compatible with a given framework, and can be any arbitrary (often relatively simple) Java object
3rd Jun 2020, 4:03 AM
Abdulsalam Al-Ashwal
Abdulsalam Al-Ashwal - avatar
+ 1
Hello yash, It can implement Serializable interface. It should implement serializable interface. It doesn’t have special restrictions other than those forced by Java language. It is a special POJO which have some restrictions. It doesn’t provide much control on members. It provides complete control on members. Fields can be accessed by their names. Fields are accessed only by getters and setters. Fields can have any visiblity. Fields have only private visiblity. There can be a no-arg constructor. It must have a no-arg constructor. i hope this will help to you
3rd Jun 2020, 5:49 AM
Ishan Shah
Ishan Shah - avatar