[java]代码库
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String name = scan.next();
String sex = scan.next();
int age = scan.nextInt();
Person p = new Person();
p.setName(name);
p.setSex(sex);
p.setAge(age);
p.print();
scan.close();
}
}
class Person{
String name;
String sex;
int age;
public void setName(String n) {
name = n;
}
public void setSex(String s) {
sex = s;
}
public void setAge(int a) {
age = a;
}
public void print(){
System.out.print("name:"+name+"; "+"sex:"+sex+"; "+"age:"+age);
}
}