问题描述
importjava.io.*;importjava.util.*;publicclassRout{publicstaticvoidmain(String[]args){//StringfilePath="d:\java\javatest\rout.txt";intreadLine[];readLine=newint[14];StringreadResult[]=newString[14];BufferedReaderreader=null;try{FileReaderfileIn=newFileReader("./rout.txt");reader=newBufferedReader((fileIn));if(reader.ready()){for(intline=0;line<readLine.length;line++){readResult[line]=reader.readLine();if(readLine.length<=0){System.out.println("指定行超出范围");}else{//System.out.println("readResult["+line+"]="+readResult[line]+",n");}}}}catch(FileNotFoundExceptione){e.printStackTrace();}catch(IOExceptione){e.printStackTrace();}finally{if(reader!=null){try{reader.close();}catch(IOExceptione){e.printStackTrace();}}}inti,j;String[]b=newString[14];double[]c=newdouble[14];for(i=0;i<readResult.length;i++){String[]ss=newString[2];ss=readResult[i].split("\s+",2);//for(j=0;j<ss.length;j++){System.out.println("ss[1]="+ss[1]);//b[i]=ss[0];c[i]=Integer.parseInt(ss[1]);//System.out.println("b["+i+"]="+b[i]);//System.out.println("c["+i+"]="+c[i]);}}doublesum0,sum1,sum2,sum3;sum0=add(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13]);sum1=add(c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13]);sum2=add(c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13]);sum3=add(c[7],c[8],c[9],c[10],c[11],c[12],c[13]);try{if(sum0==0)thrownewArithmeticException("一个算术异常");elseSystem.out.println(sum1+"/"+sum0+"="+(sum1/sum0));System.out.println(100+"*"+(sum1/sum0)+"="+(100*(sum1/sum0)));System.out.println(sum2+"/"+sum0+"="+(sum2/sum0));System.out.println(100+"*"+(sum2/sum0)+"="+(100*(sum2/sum0)));System.out.println(sum3+"/"+sum0+"="+(sum3/sum0));System.out.println(100+"*"+(sum3/sum0)+"="+(100*(sum3/sum0)));}catch(ArithmeticExceptione){System.out.println("抛出异常为:"+e);}}publicstaticdoubleadd(doubled,doublee,doublef,doubleg,doubleh,doublek,doublel,doublen,doublem,doubleo,doublep,doubleq,doubler,doubles){returnd+e+f+g+h+k+l+n+m+o+p+q+r+s;}publicstaticdoubleadd(doubled,doublee,doublef,doubleg,doubleh,doublek,doublel,doublen,doublem,doubleo,doublep,doubleq,doubler){returnd+e+f+g+h+k+l+n+m+o+p+q+r;}publicstaticdoubleadd(doubled,doublee,doublef,doubleg,doubleh,doublek,doublel,doublen,doublem){returnd+e+f+g+h+k+l+n+m;}publicstaticdoubleadd(doubled,doublee,doublef,doubleg,doubleh,doublek,doublel){returnd+e+f+g+h+k+l;}}这个程序在windows平台下能正常输出,结果也是对的。到linux下运行在50行产生数组溢出是怎么回事呢?请大侠帮忙看看