Java Scanner Tutorial

Java Scanner Tutorial

FavoriteLoadingAdd to favorites

Free preview of my Java course:

Java468x60

I recommend installing Codota autocomplete on your IDE (free):

This is exactly how you use a java scanner! ✅Hopefully, what I’ve taught you about how to use scanners can help you with your program.

👑Start practicing now with 10 free java programs –
🌅 Source Code –

You create a java scanner like this:

Scanner scan = new Scanner(System.in);

Then to get the next word of input from the console window and store it, do:

String userInput = scan.next();

This java scanner code can be tricky at first… But SURELY you’ll get it 🙂 If you followed along, congrats! You learned-by-doing!

I hope you enjoyed this java scanner tutorial! I like to have a nice mix of tutorials and actual projects for you all 🙂

Do you want to learn how to write java code from scratch, in Java? Check out my Java Tutorial For Beginners:

Was this scanner code able to get your project working? –

Free tips and programs:
Programmer Humor: – Promo code: “ALEX10” for 10% off

Recommended Channels to Subscribe to
Career Karma:
TheNewBoston:

~

(2nd channel)

Alex Lee

source

By |2020-12-02T10:52:01+00:00December 2nd, 2020|Java Video Tutorials|25 Comments

25 Comments

  1. Phunghoatrien December 2, 2020 at 10:52 am - Reply

    Thankyouu!

  2. AMAL SAKKOUMI December 2, 2020 at 10:52 am - Reply

    Thanks❤

  3. Kylo Tupaz December 2, 2020 at 10:52 am - Reply

    Thankyou for this Tutorial Alex Lee! This saved me understanding our lesson!!!❤️

  4. IT Divakar 015 December 2, 2020 at 10:52 am - Reply

    i lve ur keyboard sound…..

  5. דניאל December 2, 2020 at 10:52 am - Reply

    you are amazing. thank you for your tutorials'

  6. Ruman Jandu December 2, 2020 at 10:52 am - Reply

    neng never wrong

  7. Atta A. Azeez December 2, 2020 at 10:52 am - Reply

    thank you

  8. Nata P December 2, 2020 at 10:52 am - Reply

    Worked like a charm for me, except I didn't get a space between some words in the final output lines. Any suggestions on how to solve this issue?

  9. Laura Barragan December 2, 2020 at 10:52 am - Reply

    Love your videos

  10. Farhan Tanvir December 2, 2020 at 10:52 am - Reply

    Thank you for sharing your own talent

  11. R BRojas December 2, 2020 at 10:52 am - Reply

    Hi Alex, I was wondering why not just put scan.nextLine() straight away in line 16? Why do we have to catch the first word first and then add the rest of what was typed?

  12. DremYolok December 2, 2020 at 10:52 am - Reply

    I LOVE YOU!

  13. Dgd Sngc December 2, 2020 at 10:52 am - Reply

    glad i found this channel, just what i needed! im experiencing hardships in my first year in IT :<

  14. Gio Ralph Pusta December 2, 2020 at 10:52 am - Reply

    Thankyou sir. I liked the way to teach very detailed and its good that you do recap to make sure every line is clear. Thanks from a student of firstyear college from philippines

  15. Cody R December 2, 2020 at 10:52 am - Reply

    Thank you!

  16. RAMMUS ARMORDILLO December 2, 2020 at 10:52 am - Reply

    int x = 1;

    for(x<=3000) {

    System.out.println("Thank you !");

    x++;

    }

  17. Michael Melkonian December 2, 2020 at 10:52 am - Reply

    I always used scanner lol but never truly understood what I was doing when I thought about it.

    now its crystal clear

  18. Umaru Jan December 2, 2020 at 10:52 am - Reply

    You got my like and subscribe sir, you just gave me an idea for my Midterm projects. plus you explain it very well! Thanks again sir.

  19. Hanka December 2, 2020 at 10:52 am - Reply

    What a great way to confuse people! Your quote variable is supposed to be String quote = scan.nextLine().

  20. Kyle McCrea December 2, 2020 at 10:52 am - Reply

    can scanneers replace .getText and which is more useful when making a swing program ?

  21. Alexandre Trzcinski-Préfontaine December 2, 2020 at 10:52 am - Reply

    Thank you Alex. You are a great teacher!

  22. Tomy foul December 2, 2020 at 10:52 am - Reply

    Thank u so much for this video … can u make a tutorial about c# language, please

  23. John Raphael Cuevas December 2, 2020 at 10:52 am - Reply

    You saved my life 🥺

  24. Αλέξης Νικολαΐδης December 2, 2020 at 10:52 am - Reply

    Hello. I need some help. Every time I try to use a Scanner, I get an exception. For example, some while ago I tried to ask for the user's name (like you did in the beginning of the video) and I got this error:

    Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Sample.main(Sample.java:9)

    (Sample is the class's name). Why is this happening? Someone help me please, I am stuck

  25. HENRY LATOLLARI December 2, 2020 at 10:52 am - Reply

    Your videos are literally helping me pass my intro to java class and im learning a lot. Its kind of hard to learn all of this through a zoom call.

Leave A Comment

*