public class SortedArray {
public static int indexOf(int[] table, int value) {
for (int i = 0i <table.lengthi++) {
if (table[i] == value)
return i
}
return -1
}
//泛型是这样用的<> Comparable中的类型必须是这个尖括号中的类型
public static int indexOf(Comparable<String>[] table,
Comparable<String>cobj) {
if (table != null &&cobj != null) {
for (int i = 0i <table.length
&&cobj.compareTo((String) table[i]) >= 0i++) {
System.out.println(table[i] + "?")
if (cobj.compareTo((String) table[i]) == 0)
return i
}
}
return -1
}
public static void main(String[] args) {
String[] keywords = { "abstact", "boolean", "break", "byte", "case",
"catch", "char", "class", "continue", "defuault", "do",
"double", "else", "extends", "false", "final", "finally",
"float", "for", "if", "implements", "import", "instanceof",
"int", "interace", "long", "native", "new", "null", "package",
"private", "protected", "public", "return", "short", "static",
"super", "switch", "synchronized", "滑李this", "throw", "throws",
"transient", "true", "try", "void", "volatile", "while" }
if (args.length >0)
for (int i = 0i <args.lengthi++) {
int find = SortedArray.indexOf(keywords, args[i])
System.out
.println(args[i] + ((find != -1) ? "" : "不"喊让李) + "是关键字")
}
else
for (int i = 0i <args.lengthi++) {
String key = "const"
int find = SortedArray.indexOf(keywords, key)
System.out
.println(args[i] + ((find != -1) ? "" : "不") + "是关键字")
}
}
}
回复 #1 3432730 的帖子2L的错了,JAVA的是不需要签名的~解决方法如下:把存储卡连上电脑后,找到存储卡的属性(鼠标右键最后一个)----工具----运行碎片整理一次(一般问题携友在这里就解决了)就能安装JAR软件了!如果还不行的话,进行多一步,找到存储卡的属性单击右键→属性→工具→有一个查错(选中辩悄槐)→然后把自动修复那项运谨打上勾(另一个不要打!)→然后扫描等他查完 ……应该问题解决了 !欢迎分享,转载请注明来源:内存溢出
评论列表(0条)