Java Scanner Tutorial #14

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 พ.ย. 2024

ความคิดเห็น • 367

  • @alexlorenlee
    @alexlorenlee  ปีที่แล้ว +5

    If you’re new to programming but want a career in tech, I HIGHLY RECOMMEND applying to one of Springboard’s online coding bootcamps (use code ALEXLEE for $1,000 off): bit.ly/3HX970h

  • @Nate-jg6il
    @Nate-jg6il ปีที่แล้ว +23

    This helped me really understand the Scanner Class better. I know this is a 4 year old video but it really helped a lot. Thank you

  • @zmyslowy27
    @zmyslowy27 5 ปีที่แล้ว +65

    Worth to say that you can also use another method instead of using: quote += scan.nextLine(); you can also just type: scan.nextLine(); after previous int age = scan.nextInt();
    Also good idea is to use seperate method as:
    public int getInt() {
    int number = scan.nextInt();
    scan.nextLine();
    return number;
    }
    and just type for example:
    int numer = getInt();
    Overall great tutorial, im very new to programming myself so will use your videos for sure.

    • @Martin-jf4ji
      @Martin-jf4ji 4 ปีที่แล้ว

      dude i was having problems with my paper on passing scanners as perimeters thank you very much!

  • @Nneoh1
    @Nneoh1 4 ปีที่แล้ว +114

    Alex you're amazing at explaining these things, thanks for helping me understand those basic topics!

  • @zorogotbandz1148
    @zorogotbandz1148 4 ปีที่แล้ว +33

    Bro I gotta let you know how much your videos helped me out this semester, the language barrier with my professor made it really difficult to understand things and class, but actually learning a lot more here than in class 😅, but anyway thanks bro your really going save me this semester

  • @bhargavsai2449
    @bhargavsai2449 4 ปีที่แล้ว +146

    System.out.println("thankyou sir");

    • @peacequest2
      @peacequest2 3 ปีที่แล้ว

      Why println

    • @Steven-ke2ss
      @Steven-ke2ss 3 ปีที่แล้ว

      @@peacequest2 ln is short for line, so the linputed line will be printed which is 'thank you sir'

    • @ishworghimire3017
      @ishworghimire3017 3 ปีที่แล้ว

      @@peacequest2 to break line

    • @ishworghimire3017
      @ishworghimire3017 3 ปีที่แล้ว

      @@Steven-ke2ss hlo

    • @peacequest2
      @peacequest2 3 ปีที่แล้ว

      @@ishworghimire3017 yeah i know thx

  • @FootballJunk
    @FootballJunk 2 หลายเดือนก่อน +1

    I know python and finding it really hard to get into java for like couple of years and then i quit on java because there was no resources to learn as easy as it is in python. Then this dude came in, man i do not appreciate anyone because of my ego but u dude u killing it. Your “learn java in 14 minutes” video popped in my feed i watched it with a mindset that how much an idiot one can be who is teaching java in 14 minutes. I watched and kinda liked it. Now here i am watching full course of videos and learning java. U nailed it man. Loved it and I appreciate how easy you made it to understand. I am learning java again and finally i feel i will do a careeer switch into java , thanks to u man

  • @nazazhdar9697
    @nazazhdar9697 2 ปีที่แล้ว +2

    im lowkey crying because of how good you explained this, my teacher left it out and said do it on your own, at first i was very scared and wanted to skip it and not do it but then i came across your video and ive never understood anything better than ive undertood this, thank you so muchh!!

  • @aliobaidi8374
    @aliobaidi8374 3 ปีที่แล้ว +1

    You are a true savior. I was really confused and you explained everything to me. God bless you.

  • @michaellabeltran3807
    @michaellabeltran3807 4 ปีที่แล้ว

    School from home is hard, because sometimes we are having trouble with internet connection and I cant often understand my instructor. What I do is I go to your youtube channel and I undertand your video really well and it helps me to answer my profs activities. Thank you so much!!!

    • @michaellabeltran3807
      @michaellabeltran3807 4 ปีที่แล้ว

      You explain every topic really well , it is easy to understand and i find myself going back to your channel eveyday to learn something new

  • @alexandrahulett946
    @alexandrahulett946 4 ปีที่แล้ว +3

    I just learned more two minutes into your video than a whole week in class. Thanks!

  • @milkonion
    @milkonion 4 ปีที่แล้ว +1

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

  • @ruchikakudaskar2736
    @ruchikakudaskar2736 5 ปีที่แล้ว +156

    *0.06* Scanners aren't taught very well !!! I felt that and i used to think that i was the only one facing issues with scanner input :(

  • @nazeernero6887
    @nazeernero6887 8 หลายเดือนก่อน

    Hey Alex, I just started in college. I'm doing a Diploma in Network Systems and one of my modules is Java Programming. All my lessons are on ColCampus so I can't physically interact with my educators which is really a challenge, they don't make content as easily understandable as you do, I find myself very frustrated at times not understanding what to do, however I find your content really helpful. Thank you so much.

  • @lucaslisboacoletti8752
    @lucaslisboacoletti8752 3 ปีที่แล้ว +1

    I don't use JAVA for absolute anything but i came hearn to learn it from time to time just because u are awesome teatcher. srsly.
    Planning on put your voice on a Lo-fi beat atm.

  • @ikouve
    @ikouve 2 ปีที่แล้ว +1

    The beginning is so true:"if you like me, you may not have had a great java teacher"!. So true, SO TRUE!!!

  • @omarsuleiman9109
    @omarsuleiman9109 3 ปีที่แล้ว +7

    Why was that so much harder for my professor and boss to explain but this makes it seem like it’s kindergarten easy!
    Thanks so much for breaking it down Barney style! I learned in 12 minutes what I couldn’t for a whole day! Thanks 🙏🏼

  • @cagla3360
    @cagla3360 2 ปีที่แล้ว

    thank you so much! this is my first year in computer science and my professor doesn't upload any lecture notes to our school's website. I was hopeless about studying before I found your channel.

  • @raenamcintosh
    @raenamcintosh ปีที่แล้ว +1

    thank you so much. java is so much harder for me than python and this is the only resource getting me through my classes

  • @jorgerivera7008
    @jorgerivera7008 5 ปีที่แล้ว +55

    YOU helped my pass my final! Thank you for being so in depth, yet simple! Best tutorial vids!

    • @alexlorenlee
      @alexlorenlee  5 ปีที่แล้ว +6

      That’s awesome great job! Thanks!

    • @gregoryyang8988
      @gregoryyang8988 5 ปีที่แล้ว

      *me

    • @harshitshesh6027
      @harshitshesh6027 3 ปีที่แล้ว

      What is Resource leak "sc" please make this topic video please

  • @kazutora0468
    @kazutora0468 25 วันที่ผ่านมา +1

    Thank you so much now i know a little about Scanner and i hope i understand encoding and be better.

  • @tell1998
    @tell1998 2 ปีที่แล้ว

    Thank you for this video. I'm currently taking Java Programming for my online class and it's online only. I work full time and am a college student full time so I have little time to study and fully take it in. I haven't fully read Scanner and was a little confused from it (if I had more time I would fully understand) but being able to watch your video and get a better explanation helped me understand it better. Thank you

  • @adengouled9614
    @adengouled9614 3 ปีที่แล้ว +2

    I'm sure you've heard it before but you're a really good teacher!

  • @nookincsmama5545
    @nookincsmama5545 3 ปีที่แล้ว

    your a life saver, my teacher doesn't teach at all so this really helped

  • @larrys5904
    @larrys5904 3 ปีที่แล้ว

    First time I completely understood a tutorial on the first watch. Thank you!

  • @alyst79
    @alyst79 2 ปีที่แล้ว +1

    I have been struggling with java so much. thanks a lot for your videos

  • @jmatoya1
    @jmatoya1 3 ปีที่แล้ว

    Not even the book explains it this simple. Thank you so much

  • @nafizatasnim4691
    @nafizatasnim4691 3 ปีที่แล้ว

    yur a genius! yu solved my all problems that I have in java program.
    yu made my life easier xxxx....

  • @AleX-cc2dl
    @AleX-cc2dl 4 ปีที่แล้ว +2

    You have excellent teaching skills. Glad I found your channel. While others simply explain what to use and what the result is, you explain why to use it, and thus makes perfect sense in one's head. Thank you!!

  • @FraserFox1
    @FraserFox1 3 ปีที่แล้ว

    I had six epiphanies in the first four minutes of this video, thank you for teaching me in 12 minutes what my prof couldn't teach me in two weeks of classes!

  • @jessicaandrade3706
    @jessicaandrade3706 ปีที่แล้ว

    I’ve watched like 20 videos and this is the only one that answered all my questions ur Amazing!!

  • @kiaholyfield92
    @kiaholyfield92 4 ปีที่แล้ว +2

    This is one of the best tutorials I have seen! Thank you!

  • @dovydasbalciunas5002
    @dovydasbalciunas5002 2 ปีที่แล้ว

    Man, you really deserve to have over million subscribers. I like your teachings && I hope in the future I'll become like you!
    Thanks for the teachings! :)

  • @mcjohnbolivar
    @mcjohnbolivar 4 ปีที่แล้ว +1

    this is the lesson that i am looking for, teaching every codes uses. my professor teaching as to code but not teaching as how the code works.

  • @American_2
    @American_2 ปีที่แล้ว

    You are still helping lives

  • @kookiekookie769
    @kookiekookie769 3 ปีที่แล้ว +1

    One of the best tutorials I've ever seen thanks Alex you're amazing

  • @gioralphpusta4676
    @gioralphpusta4676 4 ปีที่แล้ว

    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

  • @ErnestoConfused
    @ErnestoConfused 2 ปีที่แล้ว

    For the next 24 hours, you are my favorite human of all time.

  • @Neoscarface6342
    @Neoscarface6342 3 ปีที่แล้ว +4

    I dont know who you are but you may have saved my semester

  • @ravipitta3388
    @ravipitta3388 3 ปีที่แล้ว +1

    Great tutorial, Alex! You've earned yourself another happy camper!!

  • @RaviPushkar
    @RaviPushkar ปีที่แล้ว +1

    Thank you Alex, just because of you I'm going to start Java on my own

  • @gyabi7785
    @gyabi7785 3 ปีที่แล้ว

    This was so amazing! I have an exam today and you helped me understand Scanner in detail with a wonderful program. TYSM!!

  • @neilcuts5771
    @neilcuts5771 4 ปีที่แล้ว +1

    you explained way better than my instructor ..

  • @mcjohnbolivar
    @mcjohnbolivar 4 ปีที่แล้ว

    this is the best tutorial for scanner in java. cool, good job now i know how scanner work in java

  • @butch2198
    @butch2198 4 ปีที่แล้ว +1

    thanks bro, you saved up my finals, I can now enjoy my christmas break :).

  • @graedenbird3020
    @graedenbird3020 3 ปีที่แล้ว +1

    You're an amazing teacher!!!!!

  • @afonnechijindu4378
    @afonnechijindu4378 2 ปีที่แล้ว

    Thanks Alex. Your explanation is top notch. Before now I wanted to skip that scanner sh*t but I could now play around with it. Thank you. AC from Nigeria

  • @jiyachhabria4795
    @jiyachhabria4795 3 ปีที่แล้ว +1

    IT WAS EXPLAINED SO WELL, OHMYGOD. THANK YOU THANK YOU THANK YOU! I guess I won't flunk computer science this year after all.

  • @Agharnaaa
    @Agharnaaa 4 ปีที่แล้ว

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

  • @Gustas100
    @Gustas100 ปีที่แล้ว

    I wanna be a programmer in the future, i just started doing programming, and this really helped, thanks

  • @alaquics5107
    @alaquics5107 4 ปีที่แล้ว

    I’m just a 10 year old kid trying to learn java and now I know a lot!

  • @darkdrift0r124
    @darkdrift0r124 2 ปีที่แล้ว

    You teach better than my lecturer thank you

  • @kylotupaz8781
    @kylotupaz8781 4 ปีที่แล้ว +1

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

  • @jawedsadat9796
    @jawedsadat9796 5 หลายเดือนก่อน

    I love the way you teach sir. Thank you!

  • @smithargaonkar3580
    @smithargaonkar3580 4 ปีที่แล้ว

    You are better than my teacher ❤️😁

  • @patrickmyers2888
    @patrickmyers2888 5 ปีที่แล้ว +1

    These videos are so clutch, thank you so much! I hope you continue to make these, they are super valuable.

  • @marvinramirez5318
    @marvinramirez5318 4 ปีที่แล้ว

    Thanks man I am building a big java project through out the semester and your videos are helping

  • @josephcarcedo83
    @josephcarcedo83 3 ปีที่แล้ว +2

    Hey, Alex, You made my schooling easy, Thank You :>

  • @AndersJackson
    @AndersJackson 2 ปีที่แล้ว

    In Eclipse, use Ctrl-Space when you have typed Scan, and you will get expansion and also imported Scanner in one go.
    I usually have System.out.print() and not println() to print prompt for telling the user what to enter.
    Scanner should also be closed before the program exits, which could be done with try-resource.
    try (Scanner in = new Scanner(System.in)) {
    String name = in.next():
    int age = in.nextInt();
    }
    And you should probably use printf() instead of println()/print() when printing out values. As you have way better control of formating the output.
    I love how you solve the problem with mixing next() and nextLine(); I will take that with me.

  • @Leo-jz3tu
    @Leo-jz3tu 4 ปีที่แล้ว

    Very good and thorough explanation bro

  • @tressaortiz2078
    @tressaortiz2078 4 ปีที่แล้ว +50

    feel like he would hold me while i cry because i am going to flunk out of school

    • @syk8151
      @syk8151 4 ปีที่แล้ว +2

      same!!!!!

    • @hawadrammeh8870
      @hawadrammeh8870 4 ปีที่แล้ว +5

      girl you got this!!

  • @creepycreeper1127
    @creepycreeper1127 5 ปีที่แล้ว +23

    Why do we have to get the first word with scan.next() and then get the rest of the line with scan.nextLine()? Is there not some way to just get the whole line from the start? It seems like extra work...

    • @afifkhaja
      @afifkhaja 4 ปีที่แล้ว +4

      I think you can just use nextLine() by itself

    • @MichaelLee-jm7mo
      @MichaelLee-jm7mo 4 ปีที่แล้ว +1

      @@afifkhaja you think? or does it work 100%?

    • @afifkhaja
      @afifkhaja 4 ปีที่แล้ว

      @@MichaelLee-jm7mo 100%

    • @akshaydeogaonkar7120
      @akshaydeogaonkar7120 4 ปีที่แล้ว +5

      @@MichaelLee-jm7mo It doesn't work...
      Actually, I got in here because of this issue only...

    • @jonahosband4534
      @jonahosband4534 4 ปีที่แล้ว +4

      @@akshaydeogaonkar7120 the reason he does that is because nextline() takes unused previous inputs as well as the remainder of a string. The previous method he uses is nextInt() which returns an integer value and when he hits enter the nextLine() method would read that previous enter as the input and not take what you want to input because the nextInt() method does not include the enter which is read as a string so therefore if you just used nextLine in that case it would pick up the enter and return a that before you can enter the code. Sorry if that seemed all over the place. I’m a college student self-learning and that’s how my CS friends explained it to me.

  • @ChamathH26
    @ChamathH26 ปีที่แล้ว

    Couldnt leave without a comment,
    Amazing 🙌

  • @kuromi3219
    @kuromi3219 18 วันที่ผ่านมา

    Alex you are 100x better than my prof

  • @IvY-zk1iq
    @IvY-zk1iq 4 ปีที่แล้ว +1

    Thanks Alex, love your simplicity. ♥️

  • @mujeebhiwadwal3573
    @mujeebhiwadwal3573 3 ปีที่แล้ว

    Thank you Alex this video really help to write my first program as beginner
    package contitionalstatmentsloop;
    import java.util.Scanner;
    public class Scannerexp {
    public static void main(String[] args) {
    Scanner scan=new Scanner (System.in);
    System.out.println("inter your first name");
    String name=scan.next();
    System.out.println("inter your subject");
    String subject=scan.next();
    System.out.println("inter your exam score");
    int examscore= scan.nextInt();
    if (examscore >= 90 ) {
    System.out.println("your Pass and your grade A");
    }
    else if (examscore>=80) {
    System.out.println("your pass and your grade is B");

    }
    else {
    System.out.println("your field ");
    }

    System.out.println("Thank you "+" "+name+" "+"yours are subject is = "+ ""+subject+ " "+"your result"+" "+examscore);
    }
    }

  • @aadityarane9108
    @aadityarane9108 4 ปีที่แล้ว +1

    It helped me a lot especially in this pandemic condition

  • @JusticeRicksUWG
    @JusticeRicksUWG 5 หลายเดือนก่อน

    bro just casually makes my life easier and saves my gpa!

  • @deusvidens
    @deusvidens 3 ปีที่แล้ว

    thanks sir this helped me very well in my studies

  • @alitahboub493
    @alitahboub493 2 ปีที่แล้ว

    THANK YOU YOU MADE THIS SO MUCH EASIER FOR ME!!!

  • @TuukkaNisonen
    @TuukkaNisonen 3 ปีที่แล้ว

    I learned more from this than a 3 hour lecture

  • @GoatMan64
    @GoatMan64 2 ปีที่แล้ว

    Bro, thank you so much for this tutorial, I love your vids.

  • @Fangli799
    @Fangli799 3 ปีที่แล้ว +1

    Thank you very much! Alex

  • @AayushBartaula
    @AayushBartaula 4 ปีที่แล้ว

    Thanks brother for me you work like parttime mentor whom i can visit whenever i want and you are always available

  • @viraltube4733
    @viraltube4733 3 ปีที่แล้ว

    love your tutorial its very clear and easy to understand

  • @chinmayeemishra6968
    @chinmayeemishra6968 3 ปีที่แล้ว +1

    We all need to get his man more subs ASAP

  • @aayushadhikari84
    @aayushadhikari84 ปีที่แล้ว

    Dude youre the realest, thank you for the explanation.

  • @johnraphaelcuevas205
    @johnraphaelcuevas205 4 ปีที่แล้ว

    You saved my life 🥺

  • @robertp.a9905
    @robertp.a9905 3 ปีที่แล้ว

    thank you for existing .

  • @sincerelysira
    @sincerelysira 3 ปีที่แล้ว

    System.Out.Println ("many thanks")

  • @austinrivers7677
    @austinrivers7677 2 ปีที่แล้ว

    Im just here because i thought my strand ICT was just focussed on hardwares but its not
    Thankfully Alex is here

  • @BlissAngel-eu4rq
    @BlissAngel-eu4rq หลายเดือนก่อน

    You are a good teacher

  • @isabanusrat8085
    @isabanusrat8085 3 ปีที่แล้ว

    Ohmygod! You are the best! Thank you, Alex!

  • @mohanish3169
    @mohanish3169 5 ปีที่แล้ว

    Yo Alex, your video helped me solve my problems and your way of teaching is simple. Thanks bud!

  • @mrh6197
    @mrh6197 ปีที่แล้ว

    Bro first video i watch and certainly won't be the last thankyou for this tutorial

  • @tanviralam9798
    @tanviralam9798 4 ปีที่แล้ว

    Thank you for sharing your own talent

  • @kalayakgosisam8816
    @kalayakgosisam8816 2 ปีที่แล้ว

    Man!! You are Great🔥🔥you make everything so easy

  • @cjm101
    @cjm101 4 ปีที่แล้ว

    Alex you are Awesome man!! thank you so much for your videos. i am studying java on a well known site and it is good but i always check youtube videos and you are very consistent on making java Understandable! thanks so much for what you do for us inspiring to get into programming.

  • @JaspaPanatoi
    @JaspaPanatoi 7 หลายเดือนก่อน

    Thank you brother. The content is very very clear and helpful

  • @roybenjamin6742
    @roybenjamin6742 3 ปีที่แล้ว

    Alex, I love you man!!! You just saved my mind from being exploded...!

  • @ajlib
    @ajlib หลายเดือนก่อน

    Thanks for your vids bud. Learning is great.
    In the quote bit, why wouldnt you just use String quote = scan.nextLine(); to begin with? Surely that works?

  • @313Mark
    @313Mark 3 ปีที่แล้ว

    your wayyyyy better than my teacher bro

  • @wallace3199
    @wallace3199 3 ปีที่แล้ว +1

    very well explained! 👍

  • @sauravneupane1620
    @sauravneupane1620 4 ปีที่แล้ว

    Ia m doing MOOC java program and I couldn't understand from text. So, I saw Ur video and did it and it worked, Thank You

  • @ayushonkar850
    @ayushonkar850 2 ปีที่แล้ว +1

    At 5:50, why did you add "Int" after scan.next?
    Hoping you will reply ASAP

  • @vinayakyadav7325
    @vinayakyadav7325 2 ปีที่แล้ว

    Perfectly explained

  • @fadzaishechamunorwa7810
    @fadzaishechamunorwa7810 3 ปีที่แล้ว

    thanks Alex your videos are so helpful. i dont know how else to show my gratitude, Thank you. i am at better position now. i hope i pass...

  • @alexandretp5665
    @alexandretp5665 4 ปีที่แล้ว

    Thank you Alex. You are a great teacher!

  • @Algebraiic
    @Algebraiic 2 ปีที่แล้ว

    Hey Alex I just wanted to start this comment by saying THANK YOU for this tutorial; you were very clear and concise with your explanation and this helped me out a ton.
    One quick question: How come you weren't required to close your scanner object by typing "scan.close();" at the end of the method? I just finished working on an assignment using Visual Studio Code; however, it wouldn't run it because I was missing that statement. I am not sure if this is something that varies according to what IDE one might be using, but any clarification would be greatly appreciated!

  • @dezthegem9522
    @dezthegem9522 3 ปีที่แล้ว

    He made that so simple great job