A. java讀入一篇英語文章,那麼應當如何將單詞生成一個字典(即按照一個單詞佔一行排序,且沒有重復單詞。
每讀一次 將字元串以空格分開 裝入set數組試試
B. java涉及到的單詞主要有哪些需要記住的!謝謝
final、public、protected、private、friendly、abstract、 static、void、class、extends、implement、import、interface、 synchronized、super、this、throw、throws、try...catch、 byte、int、long、boolean、double、true、false、new、null、short、char、 package、return、switch、break、continue、if、else、do...while、for、 等吧。這些是常見的 關鍵字。
C. JAVA編寫程序,對英文單詞按照字母順序進行排序(升序or降序)
Easy!
import java.util.ArrayList;
import java.util.Collections;
public class Main {
/**
* @param args
* the command line arguments
*/
public static void main(String[] args) {
String target = "John Bill Peter ";
ArrayList<String> list = new ArrayList<String>();
for (String temp : target.split(" ")) {
list.add(temp);
}
Collections.sort(list);
for(int i = list.size(); i > 0; i--){
System.out.println(list.get(i-1) + " ");
}
}
}
----------------
Peter
John
Bill
D. "java語言"所涉及到的英語單詞有多少都是哪些
abstract double int strictfp**
boolean else interface super
break extends long switch
byte final native synchronized
case finally new this
catch float package throw
char for private throws
class goto* protected transient
const* if public try
continue implements return void
default import short volatile
do instanceof static while
* 尚未使用的關鍵字
** 為Java 2增加的關鍵字
this指針
this指針是一個隱版含於每一個成員權函數中的特殊指針。它是一個指向正在被該成員函數操作的對象,也就是要操作該成員函數的對象。