名为“code”的字符串似乎无法读取。为什么会这样,我该如何解决?
我的代码(导致问题的代码段):
String code;
for(int z = 0; z<x;z= z+0) // Repeat once for every character in the input string remaining
{
for(int y=0;y<2;y++) //Repeat twice
{
c = (char)(r.nextInt(26) + 'a'); //Generate a random character (lowercase)
ca = Character.toString(c);
temp = code;
code = temp + ca; //Add a random character to the encoded string
}
我的错误报告:
--------------------Configuration: <Default>--------------------
H:\Java\Compiler.java:66: variable code might not have been initialized
temp = code;
^
1 error
Process completed.
(我正在使用JCreator 5.00,Java 7。)
(是的,错误报告看起来很愚蠢,但 Stack Overflow 将其读取为编码。)