While Loop Java Tutorial

While Loop Java Tutorial

FavoriteLoadingAdd to favorites

Free preview of my Java course:

Java468x60

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

This is the exact code to write while loops in java! ✅I show how to use them in your programs.

?Start practicing now with 10 free java programs –
? Source Code –

while(true) {

}

do {

} while(true);

These are the formats for how you create your while and do while loop in java. Now, you can replace “true” with an expression and whenever it’s true, it will run the code in the curly braces.

These java while loops can be trick at first… But SURELY you’ll get it 🙂 If you followed along, congrats! You learned-by-doing!

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

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

What are you using java while loops and do while loops for? –

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 |2021-01-05T11:35:23+00:00January 5th, 2021|Java Video Tutorials|33 Comments

33 Comments

  1. Sarah M January 5, 2021 at 11:35 am - Reply

    Really helpful. Thank you so much?

  2. Taha Mirza January 5, 2021 at 11:35 am - Reply

    Thank you for your efforts but you are thinking in your mind, talking to yourself and writing the code. You are not teaching someone who doesn't know all this. I did not understand. Tnx again.

  3. wolowitzard January 5, 2021 at 11:35 am - Reply

    i think my head gonna explode

  4. Alex Hill January 5, 2021 at 11:35 am - Reply

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

  5. Jeffrey Liu January 5, 2021 at 11:35 am - Reply

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

  6. Mary Rose Montebon January 5, 2021 at 11:35 am - Reply

    Can you do guessing game by using while loop?

  7. trev janke January 5, 2021 at 11:35 am - Reply

    i afsa fasfah dfsd d sd fsd s fds d fsd f sd fs d fsef f df s t wrezxfaw sdasrwrsa a s d asda d a sfg eg r as d as dawd

  8. Pamudi Irasha January 5, 2021 at 11:35 am - Reply

    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.

  9. Eden Levy January 5, 2021 at 11:35 am - Reply

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

  10. Jack SparrowX January 5, 2021 at 11:35 am - Reply

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

  11. Ino January 5, 2021 at 11:35 am - Reply

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

  12. Mother Alhariri January 5, 2021 at 11:35 am - Reply

    very good…..

  13. Elazarus Nicoy January 5, 2021 at 11:35 am - Reply

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

  14. Miguel Mayor January 5, 2021 at 11:35 am - Reply

    So I've been tasked to make a banking module. And it says that after a transaction (Withdrawing or Depositing) that I have to make it so It goes back to the beginning where it can go back and choose whether to deposit again or withdraw. Hhow do I make it do that?

  15. ETPLAYZ05 January 5, 2021 at 11:35 am - Reply

    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.

  16. Jonathan Sanchez January 5, 2021 at 11:35 am - Reply

    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?

  17. Cure Snow January 5, 2021 at 11:35 am - Reply

    Are you half Chinese Alex? Or half Korean ?

  18. Roxy January 5, 2021 at 11:35 am - Reply

    Just found your channel. Excellent video explaining while loops.

  19. Alex C. January 5, 2021 at 11:35 am - Reply

    when I'm watching your tutorials, I'm trying it out too. Thanks a lot. :

    public class exercise2 {

    public static void main(String[] args) {

    int a = 0;

    int b = 3;

    int c = 2;

    while(a < 5) {

    System.out.println("a is less than 10: " + a);

    a++;

    }

    while(b < 8) {

    System.out.println("b is, I do not care: " + b);

    b++;

    }

    while(c < 5) {

    System.out.println("c is, nothing important; " + c);

    c++;

    }

    }

    }

  20. Sky 007 January 5, 2021 at 11:35 am - Reply

    You earned my respect…
    Do you have full courses?

  21. Educare Coaching Centre January 5, 2021 at 11:35 am - Reply
  22. Modern Kids January 5, 2021 at 11:35 am - Reply

    as a student im telling u that type sout and press TAB for System.out.println(); it is a shortcut

  23. Impulsive January 5, 2021 at 11:35 am - Reply

    you see, i understand how while works, i just dont get HOW THE FUCK am i supposed to code the over complicated and useless things my teacher gives me

  24. jef January 5, 2021 at 11:35 am - Reply

    nice keyboard

  25. Piyush Chanderia January 5, 2021 at 11:35 am - Reply

    These Videos are awesome dude. You da best!!! Keep us training and educating!!!

  26. kyungsoo solo album January 5, 2021 at 11:35 am - Reply

    I WAS SO LOST HAHAHAHAHHAHHAHHA

  27. Deven A January 5, 2021 at 11:35 am - Reply

    the fuck is this you made a java basics 1 album and you fucking randomly talk about Array list and random shit i thought this would be in order like cmon bro dfuq is this shit like do i gotta watch someone else tutorial you are all over the place

  28. RareChip January 5, 2021 at 11:35 am - Reply

    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.

  29. TutorialCup Learning January 5, 2021 at 11:35 am - Reply

    There are different types of Java for loop as mentioned below. The working of for loop is the same for all the types and varies only in the syntax.
    * Simple for loop (https://www.tutorialcup.com/java/java-for-loop.htm#Simple_Java_For_Loop_example)
    * Enhanced for loop – for each loop (https://www.tutorialcup.com/java/java-for-loop.htm#Enhanced_Java_For_loop)
    * Nested for loop (https://www.tutorialcup.com/java/java-for-loop.htm#Nested_For_Loop)
    * Labeled for loop (https://www.tutorialcup.com/java/java-for-loop.htm#Labeled_For_loop)

    For more detail, you can visit one of the best articles on Java For Loop from below link
    Java For Loop – Types of for loop in Java – For Loop in Java (https://www.tutorialcup.com/java/java-for-loop.htm)

  30. Raph’s Channel January 5, 2021 at 11:35 am - Reply

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

  31. JVenom January 5, 2021 at 11:35 am - Reply

    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

  32. ForceSweep January 5, 2021 at 11:35 am - Reply

    E

  33. Green World January 5, 2021 at 11:35 am - Reply

    How do we find letters

Leave A Comment

*