String Methods Practice

String Methods Practice#

These questions are to assess your understanding of the String methods.

Consider the following variable declarations:

String yum = "mashed potatoes";
String bestPie = "a-p-p-l-e";
String obligatoryVeg = "GREEN beanS";

For each of the questions below, answer with what the resulting value will be from each expression.

Question 1 yum.charAt(3 * 2 + 1)


Question 2 obligatoryVeg.indexOf("e")


Question 3 bestPie.length()