0

unable to create object in java with lombok **noargsconstructor **added with Pojo Class

  1. I have created a** POJO class Employee**. Code mentioned below-

    @Data @NoArgsConstructor @AllArgsConstructor(access = AccessLevel.PUBLIC) @Builder public class Employee {

     @NonNull int employeeId;
     @NonNull private String firstName;
     @NonNull private String middleName;
     @NonNull private String lastName;
    

    }

  2. In Another class, i want to create object of Employee class using the below code

    Employee e1= new Employee(1,"firstTest","middleTest","lastTest");**

    // Unable to instantiate this class with the values. Seems that @NoArgsConstructor is not working. //Compile time error occured

Any help / suggestion would be much appreciate. Thank You.

0 Answers0