源自:6-5 应用 Collections.sort() 实现 List 排序
这段代码究竟哪里错了
public class Random {
String s="1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCBNM";
int num=(int)Math.random()*62;
int longNum=(int)Math.random()*11;
//下面代码“;”报错,Syntax error on token ";", { expected after this token
String[] stringArrays=new String[10];
for(int i=0;i<=10;i++){
Random b=new Random();
stringArrays[i]=b.creatString();
System.out.println(stringArrays[i]);
}
//下面代码整行报错:Syntax error on token "String", @ expected
public String creatString(){
StringBuilder strings=new StringBuilder();
for(int i=0;i<longNum;i++){
strings.append(s.charAt(num));
}
return strings.toString();
}
//下面代码“}”错误,Syntax error, insert "}" to complete ClassBody
}
提问者:昵称是JaVa
2017-01-06 10:05