package com.hui_extend;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Person[] p = new Person[2];
Scanner sc = new Scanner(System.in);
for (int i = 0; i < p.length; i++) {
Person per = new Person();
System.out.println("输入学生的姓名");
per.name = sc.nextLine();
System.out.println("输入学生的年龄");
per.age = sc.nextInt();
System.out.println("输入学生成绩");
per.score = sc.nextDouble();
sc.nextLine();
p[ i ] = per;
}
System.out.println(p[0].name);
}
}
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |