[英]Java simple for loop does not iterate
在執行過程中,將調用該方法,並且整數i
在屏幕上顯示為0
。 但是,for循環內部沒有輸出,表明for循環沒有執行。 我還使用斷點對此進行了測試,並獲得了相同的結果。 任何幫助表示贊賞。
private void decrypt_btnActionPerformed(java.awt.event.ActionEvent evt) {
int ciphertext_length = Ciphertext().length();
String decrypted_char = "";
int i = 0;
System.out.println("increment" + i);
try {
for (i = 0; i == ciphertext_length; i++) {
System.out.println("test" + i);
String cipher_current_char = getLetterAtIndex(Ciphertext(), i);
int pos_char_in_alphabet = getIndexAtLetter(Alphabet(), cipher_current_char);
decrypted_char = decrypted_char +
getLetterAtIndex(Alphabet(), pos_char_in_alphabet - 5);
status_label.setText(100 / i + "%");
}
} catch (Exception e) {
e.getMessage();
}
plain_ta.setText(decrypted_char);
}
for (i = 0; i==ciphertext_length; i++){
應該是
for (i = 0; i<ciphertext_length; i++){
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.