📄 sorttest.java
字号:
import java.io.*;
import javagently.*;
import myutilities.*;
class SortTest {
/* The SortTest program by J M Bishop Dec 1996
* ----------------- Java 1.1 October 1997
* revised August 2000
* for sorting a table, of countries or integers.
* Illustrates interfaces and
* linking up to an independent sorter.
*/
public static void main(String[] args) throws IOException {
new SortTest ();
}
SortTest () throws IOException {
Country t [] = new Country[10];
String s;
Stream in = new Stream ("Countries.data", Stream.READ);
for (int i = 0; i < t.length; i++) {
s = in.readString();
t[i] = new Country(s);
}
System.out.println("Original");
System.out.println("========");
for (int i = 0; i < t.length; i++) {
System.out.println(t[i]);
}
Sort.selectionSort(t, t.length);
System.out.println();
System.out.println("Sorted");
System.out.println("======");
for (int i = 0; i < t.length; i++) {
System.out.println(t[i]);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -