對於實例我有一個錯誤,如果想要打印輸出for
循環結束後cipher
字符串:字符追加在字符串在運行時錯誤變量可能尚未初始化
System.out.print("Cipher Text IS : >>> ");
for (int i = 0; i < len; i++)
{
char a = plainText.charAt(i);
for (int j = 0; j < allChar.length(); j++)
{
if (allChar.charAt(j) == a)
{
char c = allChar.charAt(j + key);
String cipher = "null" + c;
System.out.print("\t" + c);
}
System.out.println(cipher);
}
}
你能發佈完整的錯誤信息嗎? – Gowtham
先生我得到了點我沒有初始化密碼字符串之前for循環我定義的字符串在for循環邊界這就是爲什麼當我想訪問它的邊界然後它給出了一個錯誤謝謝你的評論.. –
問題解決後,請保持原樣。只要接受幫助你解決問題的答案即可。 – Tom