[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(name,sex,age);
p.print();
scan.close();
}
}
class Person
{
public String name;
public String sex;
public int age;
public Person(String n, String s, int a)
{
name = n;
sex = s;
age = a;
}
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+"; ");
System.out.print("sex:"+sex+"; ");
System.out.print("age:"+age);
}
}