×

Multiple-Choice Questions

Web Technologies MCQs

Computer Science Subjects MCQs

Databases MCQs

Programming MCQs

Testing Software MCQs

Digital Marketing Subjects MCQs

Cloud Computing Softwares MCQs

AI/ML Subjects MCQs

Engineering Subjects MCQs

Office Related Programs MCQs

Management MCQs

More

Method used to take a string as input in Java?

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

  1. next()
  2. nextLine()
  3. Both A. and B.
  4. None of these

Answer: B) Both A. and B.

Explanation:

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).

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.