[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
{
private String name;
private String sex;
private int age;
public String getname()
{
return name;
}
public String getsex()
{
return sex;
}
public int getage()
{
return 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.println("name:"+name+"; sex:"+sex+"; age:"+age);
}
}