本文为菠萝大象原创,如要转载请注明出处.http://www.blogjava.net/bolo 代码无真相,为了最简单的说明,我直接上代码. public class User { private String name; private Gender gender; private List<Account> accounts; 省略get和set方法 ... } public enum Gender { MALE, FEMALE } public class Account { priv…
1.需要用到的包 2.实例 实体类 people package com.shore.entity; /** * @author DSHORE/2019-4-19 * */ public class People { private int pid; private String pname; private int age; private String job; private double sal; public People() { } public People(int pid, St…
1. 首先引入jar包 在pom.xml文件里加入下面依赖: <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.51</version> </dependency> 2. 创建一个Person类(方面下面使用) public class Person implements Comp…