阅读以下说明和Java代码,将应填入______处的语句或语句成分写在对应栏内。
[说明]
某数据文件students.txt的内容为100名学生的学号和成绩,下面的程序将文件中的数据全部读入对象数组,按分数从高到低进行排序后选出排名前30%的学生。
[Java代码]
import java.io.*;
class Student
private String sNO;//学号
private int Credit;//分数
public int getCredit( )
return Credit;

public string toString( )
return"sNO="+this.sNO+",Credit="+this.Credit;

Student(String sNO,int Credit)
______=sNO;
______=Credit;


public class SortStudent
void sort(Student[]s)//Sort the array s[] in decending order of Credit
for(int i=0;i<s.length-1;i++)
for(int j=i+1:j<s.length;j++)
if(s[i].______<s[j].______)
Student tmp=s[i];
s[i]=s[j];
s[j]=tmp;




public static void main(String argv[])
Student[] testStudent=new Student[siZe];
try
BufferedReader in=new BufferedReader(new FileReader("students.txt"));
boolean done=false;
int i=0;
while(!done)
String s=in.readLine( ); //每次读取一个学生的学号和成绩
if(s!=null)
String tmp[]=s.split(",");
testStudent[i++]=______(tmp[0],Integer.parseInt(tmp[1]));
else
done=true;

in.closeo( );
______=new SortStudent( );
ss.sort(testStudent);
System.out.printin("top 30%:");
for(int j=0;j<size*0.3;j++)
System.out.printin(testStudent[j]);
catch(IOException e)
System.out.printin("io error!");
catch(NumberFormatException e)
System.out.printin("not a number!");


______int size=100; //学生总数

题库:初级程序员 类型:填空题 时间:2017-07-03 11:59:33 免费下载:《填空集》Word试卷

阅读以下说明和Java代码,将应填入______处的语句或语句成分写在对应栏内。
[说明]
某数据文件students.txt的内容为100名学生的学号和成绩,下面的程序将文件中的数据全部读入对象数组,按分数从高到低进行排序后选出排名前30%的学生。
[Java代码]
import java.io.*;
class Student
private String sNO;//学号
private int Credit;//分数
public int getCredit( )
return Credit;

public string toString( )
return"sNO="+this.sNO+",Credit="+this.Credit;

Student(String sNO,int Credit)
______=sNO;
______=Credit;


public class SortStudent
void sort(Student[]s)//Sort the array s[] in decending order of Credit
for(int i=0;i<s.length-1;i++)
for(int j=i+1:j<s.length;j++)
if(s[i].______<s[j].______)
Student tmp=s[i];
s[i]=s[j];
s[j]=tmp;




public static void main(String argv[])
Student[] testStudent=new Student[siZe];
try
BufferedReader in=new BufferedReader(new FileReader("students.txt"));
boolean done=false;
int i=0;
while(!done)
String s=in.readLine( ); //每次读取一个学生的学号和成绩
if(s!=null)
String tmp[]=s.split(",");
testStudent[i++]=______(tmp[0],Integer.parseInt(tmp[1]));
else
done=true;

in.closeo( );
______=new SortStudent( );
ss.sort(testStudent);
System.out.printin("top 30%:");
for(int j=0;j<size*0.3;j++)
System.out.printin(testStudent[j]);
catch(IOException e)
System.out.printin("io error!");
catch(NumberFormatException e)
System.out.printin("not a number!");


______int size=100; //学生总数


阅读以下说明和Java代码,将应填入______处的语句或语句成分写在对应栏内。  [说明]  某数据文件students.txt的内容为100名学生的学号和成

本题关键词:文件澄清说明,说明,处方药说明书,招标文件澄清说明,说明书,非处方药说明书,中文警示说明,工程说明,错误说明,警示说明;

微信扫码获取答案解析
下载APP查看答案解析