Developed by: Baticos, Andric Quinn S.
Code Snippet
Prediction: This code will output 14 as there are 14 characters in the string "Hello, Cadets!" (including whitespace and symbols).
Output
Observation: As expected, the value returned by the length() method was 14.
Code Snippet
Prediction: This code will output the character 'l'.
Output
Observation: As expected, the value returned by the charAt() method was 'l'.
Code Snippet
Prediction: This code will output the string 'is ' (including the whitespace).
Output
Observation: The value returned by the substring() method was 'is' only.
Code Snippet
Prediction: This code will output the strings "THIS IS A TEST" and "this is a test" respectively.
Output
Observation: As expected, the value returned by the toUpperCase() and toLowerCase() methods were "THIS IS A TEST" and "this is a test" respectively.
Code Snippet
Prediction: This code will output the indexes 16, 37, and -1.
Output
Observation: As expected, the value returned by indexOf() were 16 (first index 'f' when fox matches, 37 (match z), and -1 (no match).
Code Snippet
Prediction: This code will output the values false, true, and true.
Output
Observation: As expected, the values returned by equals() were false and true, and the value returned by equalsIgnoreCase() was true.
Code Snippet
Prediction: This code will output the new string "I like dogs. Cats are cute".
Output
Observation: As expected, the string "cats" was replaced by "dogs".
Code Snippet
Prediction: This code will remove the whitespace before and after 'Lots of spaces'. The length printed will be: 20 & 14.
Output
Observation: As expected, the whitespaces were removed and reduced the length of the string.