Using @NoArgsConstructor annotation

In this post under Lombok, I will show with example the purpose of “@NoArgsConstructor” annotation.

This annotation should be applied at the class level.

When applied it generates a no argument constructor.

Below is an example of how to use it

Person class

package package15;

import lombok.NoArgsConstructor;

public class Person {
    private String firstName;
    private String middleName;
    private String lastName;
    private int age;

Leave a Reply