Jump to content
1 hour ago, AsianBronyPie said:

Hey everyone,

I'm fairly new to Java and my teacher makes the Scanner class really confusing for me. Is there anyone that could simply explain it for me?

Thanks

It waits for a console input and lets you use it in your method.

AMD Ryzen 7800 X3D, MSI B650 Project Zero, Antec C5, Gigabyte RTX 4080 Super Aero

 

Nikon D500 | Nikon 300mm f/4 PF  | Nikon 200-500 f/5.6 | Nikon 50mm f/1.8 | Tamron 70-210 f/4 VCII | Sigma 10-20 f/3.5 | Nikon 17-55 f/2.8 | Tamron 90mm F2.8 SP Di VC USD Macro | Neewer 750II

Link to comment
https://linustechtips.com/topic/980023-java-scanner-class/#findComment-11827890
Share on other sites

Link to post
Share on other sites

8 hours ago, Fetzie said:

It waits for a console input and lets you use it in your method.

That`s true if you initialize it like that Scanner userInput = new Scanner(System.in); You can also use it to read text files and other sources and break it down line by line or using separators. But in general 

9 hours ago, James Evens said:

Read the documentation provided by oracle.

is a good advise. You don`t need to break down the source code of every class, interface and method, but reading 30 sec worth of information about what you don`t understand can help. 

Link to comment
https://linustechtips.com/topic/980023-java-scanner-class/#findComment-11828907
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×