Computer Applications

Assertion (A) next() can read the input only till the space.
Reason (R) next() only gets to the line break.

  1. Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A).
  2. Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of Assertion (A).
  3. Assertion (A) is true and Reason (R) is false.
  4. Assertion (A) is false and Reason (R) is true.

Input in Java

5 Likes

Answer

Assertion (A) is true and Reason (R) is false.

Reason — Assertion (A) is true because the next() method reads input until it encounters a space character by default. Reason (R) is false because next() stops reading at the first whitespace character (which includes spaces, tabs, and line breaks), not just at line breaks.

Answered By

4 Likes


Related Questions