Question: Q2. Write under every comment the appropriate instruction in the following program? Marks CLO 1 public class StringDemo { public static void main(String[] args) {
Q2. Write under every comment the appropriate instruction in the following program? Marks CLO 1 public class StringDemo { public static void main(String[] args) { String palindrome = " Stella won no wallets"; int len = palindrome.length; // Returns the character at index 4. 1/Compares this String to "/.*wallets". 1/Concatenates "this is palindrome string" to the end of this string. // Returns a String that represents the character sequence in the array specified. i/Tests if this string ends with "lets". //Compares this string to "agu". 1/Compares this String to "STELLA WON NO WALLETS", ignoring case considerations. // Returns the index within this string of the first occurrence of the character 'w'. // Returns the index within this string of the first occurrence of the character 'W', starting the search at 10. // Returns the index within this string of the rightmost occurrence of the substring "on". // Returns the length of this string. // Returns a new string resulting from replacing all occurrences of 'e' in this string with 'o'. //Converts this string to a new character array stellarray. 1/ Converts all of the characters in this String to lower case. 1/Converts all of the characters in this String to upper case. // Returns a copy of the string, with leading and trailing whitespace omitted
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
