I was trying out the review question from the OCP book by Jean. I came across the following code.
A.It compiles and runs without issue, outputting the total length of all strings in the
B. The code will not compile because of line q1.
C. The code will not compile because of line q2.
D. The code will not compile because of line q3.
E. It compiles but throws an exception at runtime.
I assumed that the answer for this was option e. But the correct answer is Option c.
Explaination from the book: C. The code does not compile, so A and E are incorrect. The problem here is that c1 is a
String but c2 is an int, so the code fails to combine on line q2, since calling length() on
an int is not allowed, and C is correct. The rest of the lines compile without issue. Note
that calling parallel() on an already parallel is allowed, and it may in fact return the
Can someone help me understand this please.