这是我的代码
Scanner in = new Scanner(new File("words.txt"));
int choice = 0;
String str = in.next();
int FileSize = Integer.parseInt(str);
char[] wordPlay = new char[100];
System.out.println("Filesize = " + FileSize);
int i = 0;
int count = 0;
String[] word = new String[FileSize];
String randomWord;
Random R = new Random();
for(i = 0; i < FileSize; i++)
{
word[i] = in.next();
System.out.println("Words = " + word[i]);
}
count = R.nextInt(FileSize);
randomWord = word[count];
System.out.println("Randomword = "+ randomWord);
int size = randomWord.length();
wordPlay = randomWord.toCharArray();
System.out.print("Random Word in Char =");
for(i = 0; i <size; i ++)
{
System.out.print(+ wordPlay[i] + " ");
}
System.out.println(" ");
当它通过循环时它打印出数字但不是疯狂的数字,它们似乎意味着什么,但我无法理解它。