public static String run() {
String s = "racecar";
boolean p = true;
for (int i = 0; i < s.length() / 2; i++) {
if (s.charAt(i) != s.charAt(s.length() - 1 - i)) p = false;
}
return p ? "yes" : "no";
}
// Call: System.out.println(run());What is printed?
- A
no
- Bcheck_circle
yes
- C
true
- D
racecar
Explanation
Palindrome check; "racecar" is a palindrome.