Asked by Savannah Fortson on May 05, 2024

verifed

Verified

What is the value of the variable c in the statements that follow? String phrase = "Make hay while the sun is shining.";
Char c = phrase.charAt10) ;

A) w
B) h
C) i
D) None of the above

CharAt Method

A method used to retrieve a character at a specified index within a string.

Variable

A storage location paired with an associated symbolic name, which contains some known or unknown quantity or information, known as a value.

  • Understand string manipulation and character extraction in Java.
verifed

Verified Answer

SW
Scarlett WhiteMay 08, 2024
Final Answer :
B
Explanation :
The charAt() method in Java starts counting at 0, so the character at index 10 is the letter "h". Therefore, the value of the variable c is "h".