日期:2014-05-20  浏览次数:20532 次

各位,帮忙看下这个程序有什么问题
import java.util.Scanner;
public class Max_1
{


public void Input()
{
Scanner input = new Scanner(System.in);
double max,min;
String m,n;
System.out.print("请输入学生人数:");
int num = input.nextInt();
String name[] = new String[num];
double score[] = new double[num];
for(int i = 0; i < num; i++)
{
System.out.print("请输入学生姓名:");
String a = input.next();
name[i] = a;
System.out.print("请输入"+name[i]+"同学的成绩:");
double b = input.nextDouble();
score[i] = b;
}
max = min = score[0];
m = n = name[0];
for(int i = 1; i < num; i++)
{
if(max < score[i])
{
max = score[i];
m = name[i];
}
if(min > score[i])
{
min = score[i];
n = name[i];
}
}
System.out.print(m+"同学的成绩最高:"+max);
System.out.print(n+"同学的成绩最低:"+min);

}

public void main(String[] args)
{

Input();
}
}

------解决方案--------------------
恩,可以这样解决。

也可以new Max_1().input();
------解决方案--------------------
探讨
呵呵 ,谢谢各位大大了,我是刚学的JAVA,这书我实在是没办法了,照着书上打上去都是错的。


public class Point
{
protected int x;
protected int y;
protected Point(int x,int y)
{
this.x = x;
this.y = y;
}
public void draw()
{
Syste……