a. Math.abs(14/5);
b.Math.pow(14,5);
c. double chocAmount = 14.0/5.0;
//chose between these 3 options
Answer: C would be the only option that fits your needs because you don’t want an absolute value for your number of chocolates. It has to be accurate, and you don’t need exponents either. You just want to find out how to split the chocolate amount. So, this would be your answer.
String s = “This is the beginning”;
String t = s.substring(5);
int n = t.indexOf(“the”);
Answer: The value of n will be 3. The question is asking for the value of n, which is the indexOf “the” in String t, which is essentially just a substring of string s. Determine t first, which is the substring that begins at the index 5 of s. Start at 0 and count the spaces as different characters. Index 5 is the letter i, at the beginning of the word is. Since string t is a substring of s, the sentence for this substring would be “is the beginning”. the index of “the” is 3 because it begins at index 3.
\