Write a Java program segment to change the case of every letter of a string s.
String Handling
Original Khojo Papers practice question — not from a past board paper.
A String object is immutable while a StringBuffer object can be changed in place. StringBuffer provides methods such as append, insert, delete and reverse that String does not. Repeated concatenation with String creates a new object each time and is slow, whereas StringBuffer modifies one object and is efficient.
No citable source has been recorded for this record. Treat it as practice material, not as fact.
StringBuffer is synchronised; StringBuilder is the unsynchronised and faster equivalent.
From the same topic and chapter, at a similar level.
Write a Java program segment to change the case of every letter of a string s.
String Handling
Write a Java program segment to count the words in a sentence s that has single spaces between words.
String Handling
Write a Java program segment to count the number of vowels in a given string s.
String Handling
What is the output of: String s = "Programming"; System.out.println(s.indexOf('g') + " " + s.lastIndexOf('g') + " " + s.replace('g', 'G'));
String Handling
What is the difference between s1 == s2 and s1.equals(s2) for two String references?
String Handling
State and verify the absorption law X + X·Y = X using a truth table.
Boolean Algebra