Question: 8. Consider the following code segment where IO.readWord() is a call to a method that reads a String. String word =10.readWord (); For (int i=0;
8. Consider the following code segment where IO.readWord() is a call to a method that reads a String. String word =10.readWord (); For (int i=0; i kword length ()1;i++)( if (word. substring (i,i+1).equals (word. substring (i+1,i+2))) f return true; 1 return false; Which of the following describes its results? Why? a. Returns true if any letter in word is repeated, false otherwise. b. Returns true if the first and second letters are the same, false otherwise. c. Returns true if any two consecutive letters are the same, false otherwise. d. Always returns true. e. Always returns false
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
