Computer Science, asked by Anonymous, 7 months ago

what is the syntax for input of string by scanner class​

please give relevant answers​

Answers

Answered by adrin14
1

Answer:

To create an object of Scanner class, we usually pass the predefined object System.in, which represents the standard input stream. We may pass an object of class File if we want to read input from a file. To read strings, we use nextLine(). To read a single character, we use next().

Answered by vy1551128
1

Answer:

like

Explanation:

To read strings, we use nextLine(). To read a single character, we use next(). charAt(0). next() function returns the next token/word in the input as a string and charAt(0) function returns the first character in that string.

Similar questions