a) Compiler error
b) Runtime exception
c) Prints "Match not found"
d) Prints "Match found"
I answered "Match not found", which is correct, but their explanation seems a little bit strange to me.
The find method scans the input sequence looking for the next sequence that matches the pattern. Since the starting letter of "Water" is in uppercase, it does not match with "water". So the find method returns false and "Match not found" is printed out. So choice C is incorrect.
Even if we change the uppercase "W" to a lowercase "w" this will still print option C, because the longer string is the pattern, in order to have option D, we also need to switch the strings, the pattern should go to input, and vice versa.
What do you think guys ?!
By the way, how is WHIZLABS, does it make sense to pay attention to their mocks for exam preparation ?!