Is there a way to read everything from an STDIN Java Scanner? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is there a way to read everything from an STDIN Java Scanner?

I'm wondering if it's possible to read everything from a Scanner(System.in) and store it into one variable. There could be any number of lines.

16th Jun 2018, 2:48 AM
Physh
Physh - avatar
1 Answer
+ 1
the concept of generics class. will help you to do this. https://www.sololearn.com/learn/Java/2220/?ref=app yes you can read whole string. using function nextLine() and store in a single reference variables of String class
16th Jun 2018, 6:57 AM
Arun Tomar
Arun Tomar - avatar