Welcome to the CSC Q&A, where you can get help (and share your knowledge) about computer science!

(Another) Question about Self-Check 3.19

+9 votes
I understand how to evaluate all expressions except for:



Can someone point me in the right direction?
asked Sep 21, 2016 in CSC 211 (F16) by Jordan Peklo (100 points)

1 Answer

+4 votes
Best answer
It'll first convert the whole str1 to lowercase letters, and then Java will try to find the index of "B". Since the new string is now in all lowercase, Java wouldn't find any uppercase "B". It will then return the value of -1 as the expression of "I can't find any uppercase B".
answered Sep 21, 2016 by Minh Ta (100 points)
selected Sep 22, 2016 by Jordan Peklo
Awesome, thank you!