R

Ram Sharma • 193.86K Points
Coach

Q.  Method used to take a string as input in Java?

  • (A) next()
  • (B) nextLine()
  • (C) Both A and B.
  • (D) None of these
  • Correct Answer - Option(C)
  • Views: 151
  • Filed under category JAVA

Explanation by: Team MCQ Buddy
The next() method can read the input only till the space. It can't read two words separated by space, while the nextLine() reads input including space between the words (that is, it reads till the end of line \n).

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics