About Question enthuware.ocpjp.v17.2.3675 :
Posted: Sun Jan 14, 2024 1:39 pm
Hi,
I'd like to point out that this question seems straightforward but actually touches on an important issue.
Consider what happens if s1 is defined like this:
Or would there be any difference with this variation?
In this context, I have no questions but in the explanation there's a bit of confusion as to why s1.split("\\n").length is 2 instead of 3, even though there appear to be 3 lines. Could the last element of the array be an empty string, perhaps? Maybe that can be added to the explanation.
I'd like to point out that this question seems straightforward but actually touches on an important issue.
Consider what happens if s1 is defined like this:
Code: Select all
String s1 = """
a \
b \t
c \s
efg""";
Code: Select all
String s1 = """
a \
b \t
c \s
efg
""";