While Loop Java Tutorial #37

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

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

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

    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

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

      Are you sureeeeee

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

    I'm a beginner for Java so I get doubts pretty much every time. Sometimes when I listen to my lecturer and I don't get what he says, I get a headache but at the same time your videos come into my mind and my worries subside. Cause I know I can always rely on your videos. Thank you very much for the support.

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

    I love how the outro is always thanking us for being here when we can be anywhere in the world - meanwhile I am driving so I am everywhere and still here.
    I do like the kindness, keep that up!

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

    I've only recently started watching this playlist on Java Basics 1. I have to say this one video Is the only difficult one yet for a beginner since It feels out of order. I'll have to watch ArrayList video and then come back to recap on those last few minutes.

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

      yes this is like the only one where honestly I was confused watching

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

      maybe this: th-cam.com/video/8FLgge8QydI/w-d-xo.html

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

      At least I'm not the only one who thinks this is kind of confusing.

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

      I now recapped and this is nothing haha I was confused too

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

      this isnt recent thats 10 months ago

  • @funandusefulinfo
    @funandusefulinfo 3 ปีที่แล้ว +19

    Hello! I know you don't make the Java tutorials anymore, but just wanted to say thank you. They are so helpful!

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

    Idk if u remember but u helped me out with a do_while loop in a guess the number project i was working on. Glad u finally made a video! Very helpful

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

      Daniel Maddox awesome, any time!

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

      He does not remember 😜

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

      Yes I also need to make a guessing game for my school assignment. This video also helped out as well! Thanks Alex!

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

    its not everyday i to get see handsome guy teaching me coding

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

      Shoot your shot! 😂🤣 Alex Lee, what's your response?

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

      I'm shooting too

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

      ikr that too in a understandable manner

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

      Ikr lmaoo

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

      Did this work? Are they married?

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

    Nice! Loops are pretty essential for coding, this is good to know.

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

    Hi, thank you for making these. Recently started learning about java and these videos are a lot of help. Summarizing a big concept in 6-8 min is a winner! Hope you will make more videos in the future about other program languages :)

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

    I am now studying java because of my school, even though I can't easily understand. I will do ma best for this :)

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

    I’ve been watching all ur videos they really help. I actually learned the first course of c++ but my next class is in java and I’ve legit been watching all of this to see what’s different from c++ to java

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

      You are looking good. Learning c++ first will make things a lot easier for you.

  • @5starplsmihoyo288
    @5starplsmihoyo288 3 ปีที่แล้ว

    I'm here to learn about while loop but I'm kinda in love with your keyboard I love the sound

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

    You are the best!!! I have subscribed and liked all most every video of yours!!!!!!

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

    I was looking for something like this!! Finally, ty.

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

    Hello, so im working on a program for my class and im having trouble with my method, specifically the looping part. So, ive done research and still couldnt find an answer so im hoping maybe you could help.
    In my method im suppose to search if the user input matches my string array, and if it doesnt match the program should keep looping until the user types in a string that matches one of the strings in the array and returns the index that corresponds to the input. I have tried multiple loops but it 1. loops on forever even if I input the correct 2. Doesnt loop at all

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

      Hey Jhaz, well you're definitely on the right track using a while loop. You're gonna want to use that until the user enters a string that matches your array. So I can be more helpful for you, you can email me your code and a brief description to my email, alexlorenlee@gmail.com and I'll see what I can do to help you get it working

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

      Alex Lee thank you! Unfortunately I wasnt able to work on my program today, but ill def tmrw nd send you a email

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

    Huhu tnx for this, I'm going to make presentation about while loops in our Java Subj. It helps me a lot🥰

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

    I didn't know Scanner scanner = new Scanner(); could have anything besides a (System.in); statement....This changes things... thanks!

  • @aleph-not
    @aleph-not 4 ปีที่แล้ว +2

    Nice HHKB! I have one too, and my dream keyboard is the Norbauer Heavy Grail.

  • @diamonx.661
    @diamonx.661 3 ปีที่แล้ว

    You used angle brackets when using the ArrayLists, which you didn't use in your other video where you exclusively talked about them. Is there a situation where using, for example, is crucial for the program to work?

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

    Hello :D
    I have a question:
    Why this line of code looks like this :
    ArrayList words = new ArrayList();
    and not like this:
    ArrayList words = new ArrayList();
    As i checked it also works, so can I use each of those alternately? :D

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

      I would like to know the answer to this too!

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

    straight to the point , I love it ! as a complet beguinner thanks a lot for your hard work , keep up

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

    I wish you were my Java teacher! You are awesome!

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

    i like background instrument while watching your leasons wonderfull.......😍😍😍

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

    Hey, Alex! The video was quite informative and helpful. I get to know a lot about Java... thanks to you...

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

    Just found your channel. Excellent video explaining while loops.

  • @Sky-zg8lz
    @Sky-zg8lz 4 ปีที่แล้ว

    You earned my respect...
    Do you have full courses?

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

    tysm ur carrying my ap comp sci grade 🙏🙏

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

    Thank you Alex, I appreciate the explanation and then then the further introduction to other concepts that I'll be seeing in the future.

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

    Thank you dude this helped out a lot

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

    6 january 2022 great day an lesson,Thanks Alex

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

    This explains reincarnation, and why people feel "stuck in loops" every day. Why they feel like they cant get ahead in life.

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

    The type ArrayList is not generic; it cannot be parameterized with arguments
    It is showing me error

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

    thank you, you always make things easier

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

    Thanks for all these vids bro
    Really helps

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

    I love ur explanation it's so easy to understand, keep up the good work 💗!!

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

    Why do you add a new class when you start the project?

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

    I want to say thank you for these videos! They are super helpful :)

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

      yeah sooooo how'd the flat tummy challenge go?

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

      @@TrevCommentsStuff i hope ur not bad at soccer .

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

    hey Alex I'm stuck on one while loop, Is there any way you can help me out Please

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

    how would I create a sequence of while loops?
    for example, if i wanted the first while loop to count from 1-10, the next 10-1, would I add that all in the same class?

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

    i want to break from a while loop when the user enter specified letter how can i do it he told me could not convert string to float: 'e'

  • @Sarah-jk1hk
    @Sarah-jk1hk 3 ปีที่แล้ว +1

    Really helpful. Thank you so much💜

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

    Love the keyboard

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

    Hello brother I have a doubt can u tell me how we can remove those commas between them
    and thank you for doing such a great job thank you so much

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

    which keyboard are you using i totally dig the retro look and sounds less clicky than mine

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

    Would you be able to do an example of do-while loop but instead of integer to terminate the program we use a string to stop the program? e.g. while(value == "stop")

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

    What app is he running that allows him to practice code?

  • @KiranKumar-kx7wi
    @KiranKumar-kx7wi 3 ปีที่แล้ว

    last line ❤
    thanks for the videos bro... it is very useful for me ... 2021

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

    Excellent! Very helpful 🙏🏻 massive thanks

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

    what's with the old school keyboard?

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

    god i love this channel

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

    Hi do you have a video of where you use while, for loop, or do while where you can display the string depending on the of times given by the user?

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

    Hi. How a while loop can end when the user press "ENTER"? Thanks.

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

    Thanks a lot,
    your explanation was really amazing and it was really helpful

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

    @Alex Lee what kind of key switches do you have in that keyboard? I really like the sound.

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

      I know, I was asking about the switches. Thank you, though!

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

    This video help me alot!

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

    can you make an array of numbers that has negatives and positives and separate only the negative?

  • @pasaguialejandrob.4601
    @pasaguialejandrob.4601 3 ปีที่แล้ว

    How do you stop while loop if you're gonna input a keyword Stop or End?

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

    Would you please make a new Print video and include the functionality of Printf?
    You're my preferred go to when I need help. Thank you

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

    I can ask you how much year after achieve you programming and ano you learn ihope you answer my question becuase I like programming but I'm newbie

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

    I wish you are my professor for the CS class

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

    This helped me so much!!

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

    Thanks a lot brother ❤ this helps me so much!

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

    Alex, can you have a switch statement inside a while ?

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

      Yes, you can. Do you have any examples in mind that I can try?

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

      // Create an array, it could be anythin....
      ArrayList months = new ArrayList();
      // Add elements to it.
      months.add("Jan");
      months.add("Feb");
      months.add("Mar");
      months.add("Apr");
      int index =0;
      Scanner sc = new Scanner(System.in);
      System.out.println("Enter your guess: ");
      String input = sc.nextLine();
      while (index < months.size()){
      switch (input){
      case "Jan":
      System.out.println("The month is: " + input);
      break;
      case "Feb":
      System.out.println("The month is: " + input);
      break;
      case "Mar":
      System.out.println("The month is: " + input);
      break;
      case "Apr":
      System.out.println("The month is: " + input);
      break;
      default:
      System.out.println("I don't know your guess.");
      break;
      }
      index++;
      input = sc.nextLine();
      }
      sc.close();

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

    How do you use a system.in.read(); in a while or do while loop where it makes a random number and you have to guess a number 1-10 and if you guess the right one it stop the program but if it's incorrect it says guess again.

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

    Thank you these videos are awesome. Do you have a video on adding repetition statements in a netbeans menu?

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

    Thank you!

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

    Hi Alex, love your videos they are awesome. I was hoping you could explain this line of code:
    While(counter >0 & & counter

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

      && means "and" it adds a secon boolean

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

      while( counter is greater than 0 && AND counter is less than or equal to number){.....}
      Whatever in the () is always a boolean, meaning the complier will check if it evaluates to true or false. In the above example, you are basically asking the language each time the loop runs, "Is the counter greater than 0? AND the counter less than or equal to the number?) And that will produce either false, or true.

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

    Yo this is better then code.org

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

    Great video as always but that was definitely confusing.

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

    best tutorials

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

    is an instance variable a field?

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

    Good music! And nice video too ;)

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

    You're a cool dude, thank a lot!

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

    Can you do guessing game by using while loop?

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

    Awesome 🙌🏼

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

    Can someone help me with this:
    Write a while-loop that prints x plus signs on the same line.
    public static void runLoop(int x){
    // complete the loop below
    while(){
    System.out.print();
    }
    }

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

    Hi Alex! thanks for the tutorials.. You Are The Man :)) but I have a question...
    Let's say that I'd like to create an arraylist like this ;
    String words [ ] = { } ; instead of ArrayList words = new ArrayList(); or
    ArrayList words= new ArrayList();
    but the problem is... when I want to add the words that we scan on the string that we created to the list , I get an error..
    ("Cannot invoke add(String) on the array type String[]
    ") I've tried to use Arrays.toString() method.. but I guess there is
    something that I miss.. Could you help me out?

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

    WoW great thank you so much 😘

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

    hello, do you have a video where you input a number and a sentence repeats on what number you did input, if that makes sense 😅

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

      I think that's for loop?

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

      @@EasyThings_ thanks

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

    Do - while is a post test loop

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

    Thanks bro

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

    curly brace should always be on the same line

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

    for the while loop of a < 10 I wrote the exact same program but mine didnt stop at 9 like yours did, mine kept going on. Do you know why?

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

      a++

  • @mevatunc6732
    @mevatunc6732 3 ปีที่แล้ว +6

    10th time watching this video, thanks for saving my career(I'm 16 yo)

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

    can i ask you what a++ mean? i think its like "oh, add one to a" but i'm not sure...

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

      a++ is equivalent to "a = a+1". This means that i every loop, the value of a increases by 1.

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

      @@advaithbala thx

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

    Thanks a lot

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

    Why does a while loop crash my program? This is why I've tried to stay away from while loops

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

      Can you paste the code you expected will crash your program? maybe I can help!

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

    nice keyboard

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

    i just realized, wait that's possible? then i should have use that on my assignments.
    anyways, wow great job

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

    You may want to reorganize this video on the playlist. the arraylist is very out of place and I was very confused when you brought that up.

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

      @@javatutor8322 Please stop spamming other people's channel to get yourself noticed. If people want they'll watch your content.

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

    Maybe it’s just me, but I find the hand cam distracting. I can see what you’re typing on the screen, I don’t need to see your hands do it. Not trying to be a hater though, programming TH-camrs like you have saved my grade many times, much respect.

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

    How do you nest while loops using if, else if, or else?

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

      Like what do you need the nested-if-else-if to do? Do you have any specific problem in mind?

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

    really blurry, but thank you for doing this...

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

      Get glasses then blindy

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

    mad dog! thanks so much!!!

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

    How do you use this using JOptionPane and with words instead of numbers

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

      Tell me exactly what kind program you want, and I will solve it for you. Do you want to ask the user a string until the user matches a string in an array in JOptionpane.showInputMessage() method? If that is, It is easy!

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

    very good.....

  • @ma.jessicatoralde9654
    @ma.jessicatoralde9654 3 ปีที่แล้ว

    I always find a way how to learn programming it's hard especially I'm a beginner then I saw this video 🧐

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

    you better save my grade

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

    you are amazing

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

    THank you, broooooooo