Reputation: 5773
I have a doubt regarding POJO.
Take below example
public class User
{
String user="";
String password="";
String firstName="";
String lastName="";
ChallengeQuestions challengeQuestions;
//getter and setters for these prooperties
}
public class ChallengeQuestions
{
String question="";
String answer="";
//getter and setters for these properties
}
Here is my question, whether User
class is a POJO or not.
Thanks,
Narendra
Upvotes: 2
Views: 922
Reputation: 54074
POJO i.e. Plain Old Java Object refers to all user defined types that do not have to extend a specific/special prespecified class or specialized prespecified interface.
Your class fits in this category so it is a POJO.
Upvotes: 3
Reputation: 533492
I would have said that a POJO is distinct from a JavaBean. A POJO does not need to have setters or getters and it would more clearly be a POJO without them.
Your comments suggests you intended to add getters and setters to follow the JavaBean standard and as such this is not a POJO as it is intended to comply with the JavaBean convention.
Upvotes: -1
Reputation: 5194
Yes, it is. See 'Plain Old Java Object' (Wikipedia).
The term "POJO" is mainly used to denote a Java object which does not follow any of the major Java object models, conventions, or frameworks.
Upvotes: 3