java用builder构建对象
/**
* @Author: liuxuewei
* @Date: 2022/7/4 11:18
* @Description:
*/
public class Test74 {
public static void main(String[] args) {
Ydd ydd = Ydd.builder()
.name("ydd")
.sex("男")
.age(66).build();
System.out.println(ydd);
}
@Data
@Builder
public static class Ydd{
private String name;
private String sex;
private Integer age;
}
}
评论区