Write a Java program segment to check whether a given string s is a palindrome.
String Handling
Original Khojo Papers practice question — not from a past board paper.
System.out.print(s.charAt(0)); for (int i = 0; i < s.length() - 1; i++) if (s.charAt(i) == ' ') System.out.print(s.charAt(i + 1));
No citable source has been recorded for this record. Treat it as practice material, not as fact.
The first letter has no space before it, which is why it is printed separately.
From the same topic and chapter, at a similar level.
Write a Java program segment to check whether a given string s is a palindrome.
String Handling
What is the output of: String s = "Examination"; System.out.println(s.length() + " " + s.substring(0, 4) + " " + s.toUpperCase().charAt(2));
String Handling
What is the output of: String s = "Computer"; System.out.println(s.substring(2, 5) + s.length() + s.charAt(0));
String Handling
Explain what is meant by saying that String objects in Java are immutable, and name the class to use when a mutable string is needed.
String Handling
Explain the ternary operator in Java and rewrite "if (a > b) max = a; else max = b;" using it.
Operators and Expressions in Java
Reduce the Boolean expression X·Y + X·Y′ using the laws of Boolean algebra.
Boolean Algebra