[问答题] 请完成Java程序:本题是一个冒泡排序程序的实例。冒泡排序的含义是将相邻的两个数作比较,如果是升序排列的话,如果前边的数大,则将两个数交换。从第一个数开始两两比较一次,就可以将最大的数移动
[问答题] 请完成Java程序:本题是一个冒泡排序程序的实例。冒泡排序的含义是将相邻的两个数作比较,如果是升序排列的话,如果前边的数大,则将两个数交换。从第一个数开始两两比较一次,就可以将最大的数移动到最后。
注意:请勿修改main()主方法和其他已有语句内容,仅在横线处填入适当语句。
import java.io.*;
public class simple
public static int[]Data=new int[10];
public static void main(String[] args)
int i;
int Index;
Index=0;
InputStreamReader ir;
BufferedReader in;
ir=new InputStreamReader(System.in);
in=new BufferedReader(ir);
try
do
System.out.println("Please input the number"+
Index+"you want to sort(Exit for 0):");
String s=in.readLine();
Data[Index]=Integer.parseInt(s);
Index++;
while(Data[Index-1]!=0);
catch(IOException e)
System.out.println(e.getMessage());
System.out.print("Before bubble
参考答案: