昵称是JaVa
2017-01-06 10:05
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 }
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]; public void Random(){ for(int i=0;i<=10;i++){ Random b=new Random(); stringArrays[i]=b.creatString(); System.out.println(stringArrays[i]); } } public String creatString(){ StringBuilder strings=new StringBuilder(); for(int i=0;i<longNum;i++){ strings.append(s.charAt(num)); } return strings.toString(); } }
Java入门第三季
409792 学习 · 4340 问题
相似问题