Hi classs, please explain to me: Can we get input from file using Scanner object? I think we can do that. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hi classs, please explain to me: Can we get input from file using Scanner object? I think we can do that.

Scanner to get input from file

14th Jun 2023, 4:16 AM
Oliver Pasaribu
2 Answers
+ 4
You sure can, just assign the file to a variable and create a Scanner(yourFileVariableName) object instead of Scanner(System.in)
14th Jun 2023, 4:33 AM
Orin Cook
Orin Cook - avatar
0
Thank you
14th Jun 2023, 10:12 AM
Oliver Pasaribu