【发布时间】:2015-06-19 03:20:38
【问题描述】:
我在下面写了代码来搜索一维数组中的最大值。但由于某些错误,它无法正常工作。下面是代码:
import java.io.*;
public class theHigest{
int max = 0;
int[] value = new int[5];
BufferedReader objInput = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[]args){
theHigest obj6 = new theHigest();
obj6.input();
}
void input(){
try{
for(int i=0;i<=4;i++){
System.out.println("===========================");
System.out.print("Value input-"+(i+1));
value[i]= Integer.parseInt(objInput.readLine());
System.out.println("===========================");
}
}
catch(Exception e){
System.out.println("Error "+ e);
}
}
}
【问题讨论】: