for (int i = 0; i <= (line.length()/2); i++) { \\loops from the first character until the character in the middle
if (line.charAt(i) != line.charAt(line.length() - i)) { \\checks if 1st character of line is not equal to the last character, and so on..
System.out.println("Entered string is not a palindrome.");
return; \\ends program, no need to check anything else
}
}
System.out.println("Entered string is a palindrome.");
내가 범위 에러에서 인덱스가 계속에게 회문 확인하기 위해확인 문자열이 회문
오류가 무엇인지, 왜 그런지 이해하기 위해 노력 했습니까? – tnw
첫 번째 단계는 그 의미를 조사해야합니다. – krillgar
이 계산을 종이에하십시오 (인덱스는 0부터 시작합니다). – Pshemo