Advertisements
Advertisements
Question
Write the output of the following.
boolean b3 = Character.isWhitespace('\n');
System.out.println(b3);
Very Short Answer
Advertisements
Solution
true
Explanation:
The method Character.isWhitespace('\n') checks whether the given character counts as blank space. Because '\n' represents the newline character (which creates a blank line space when you press Enter), Java classifies it as a whitespace character, evaluating the expression to true.
shaalaa.com
Is there an error in this question or solution?
Chapter 5: Library Classes - Exercises [Page 135]
