从键盘输入三个学生的五门成绩
package stu;import java.util.Scanner;
public class student {
public static void main(String[] args){
//从键盘输入三个学生的五门成绩
St s[] = new St[3];
s[0].info(0);
s[1].info(1);
s[2].info(2);
}
}
class St{
//学生五门课,学号和成绩
String Name;
public String getName(String name) {
return Name = name;
}
int Num;
public int getNum(int num) {
return Num = num;
}
double Chinese;
public double getChinese(double chinese) {
return Chinese = chinese;
}
double Math;
public double getMath(double math) {
return Math = math;
}
double English;
public double getEnglish(double english) {
return English = english;
}
double Phyics;
public double getPhyics(double phyics) {
return Phyics = phyics;
}
double Chemistry;
public double getChemistry(double chemistry) {
return Chemistry = chemistry;
}
public void info(int i){
St s = new St();
System.out.println("请输入第" + i+1 +"个学生的信息");
//输入学生的名字
System.out.println("姓名:");
Scanner n = new Scanner(System.in);
String name = n.nextLine();
s.Name = s.getName(name);
//输入学生的学号
System.out.println("学号:");
Scanner b = new Scanner(System.in);
int num = b.nextInt();
s.Num = s.getNum(num);
//输入学生的语文成绩
System.out.println("Chinese:");
Scanner c = new Scanner(System.in);
double chinese = c.nextInt();
s.Chinese = s.getChinese(chinese);
//输入学生的数学成绩
System.out.println("Math:");
Scanner d = new Scanner(System.in);
double math = d.nextInt();
s.Math = s.getMath(math);
//输入学生的英语成绩
System.out.println("English:");
Scanner e = new Scanner(System.in);
double english = e.nextInt();
s.English = s.getEnglish(english);
//输入学生的物理成绩
System.out.println("Phyics:");
Scanner f = new Scanner(System.in);
double phyics = f.nextInt();
s.Phyics = s.getPhyics(phyics);
//输入学生的化学成绩
System.out.println("Chemistry:");
Scanner g = new Scanner(System.in);
double chemistry = g.nextInt();
s.Chemistry = s.getChemistry(chemistry);
}
}
为什么不能运行?求大神指点。