Search code examples
javapojooop

Is this class a POJO


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


Solution

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