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指针是一个隐版含于每一个成员权函数中的特殊指针。它是一个指向正在被该成员函数操作的对象,也就是要操作该成员函数的对象。