1
2
3
4
5
6
7
8
|
public
class
User
{
private
String name;
private
int
age;
private
long
phone;
private
List
...set和get方法
}
|
初始化User的实例src:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
Java代码
User user1 =
new
UserVo();
user1 .setName(
"user1 "
);
user1 .setAge(
30
);
user1 .setPhone(13789126278L);
UserVo f1 =
new
UserVo();
f1.setName(
"tmac"
);
f1.setAge(
32
);
f1.setPhone(123L);
User user2 =
new
User();
user2 .setName(
"user2 "
);
user2 .setAge(
29
);
user2 .setPhone(123L);
new
ArrayList
friends.add(user1 );
|