Java for loop ➰

Поделиться
HTML-код
  • Опубликовано: 7 окт 2024
  • Java for loop tutorial
    #Java #for #loop

Комментарии • 122

  • @BroCodez
    @BroCodez  4 года назад +62

    public class Main {
    public static void main(String[] args) {

    // for loop = executes a block of code a limited amount of times

    for(int i=10; i>=0; i--) {
    System.out.println(i);
    }
    System.out.println("Happy new year!");

    }
    }

    • @fish0798
      @fish0798 Год назад +2

      Thx

    • @carlpilongo539
      @carlpilongo539 Год назад +1

      im using jdoodle since my laptop is kinda dying
      i just wanna asked why it didn't print my "for loop"?

  • @adannimpa
    @adannimpa Год назад +12

    your explanation is more easy to understand than what my prof taught me thank you so much BroCodez!

  • @DucatiSydney
    @DucatiSydney 2 года назад +10

    My bro is killin the teaching! Relaxed way of learning and great detail. Please upload more videos on loops with interesting examples

  • @pavelkvasnicka6856
    @pavelkvasnicka6856 Год назад +4

    This is the best Java tutorial for beginners, so you can learn Java and English in one hit. Please keep going! I vote for Java advance tutorial. Thanks a lot Bro

  • @ვ3ვ3ვ
    @ვ3ვ3ვ 11 месяцев назад +14

    When get stuck on java, watch bro code videos! ❤

  • @BananaMan6763
    @BananaMan6763 22 дня назад

    At his time I'm trying to learn a bit of Java so I can have a better chance at being a programmer in my robotics club at school, but I have struggled way too much, and it's ironic because I learned the basics of c# before Java. Thanks for making this since it can help me a bit with the learning process.

  • @ramakrishnatallapragada7569
    @ramakrishnatallapragada7569 Год назад +4

    Thank u bro this helped me a lot in understanding the for loop concept crystal clear
    I'm currently in 9th standard and I'm from INDIA

  • @eugenezuev7349
    @eugenezuev7349 6 месяцев назад

    I like the short format of ur videos and combining them with other sources

  • @hpn1427
    @hpn1427 7 месяцев назад +4

    🎯 Key Takeaways for quick navigation:
    00:30 🔄 *For loops in Java execute a block of code a limited number of times, unlike while loops which can continue infinitely.*
    00:45 🔄 *For loops iterate a known number of times; the number of iterations is defined before the loop begins.*
    00:59 🔄 *To create a for loop in Java, use the `for` keyword followed by parentheses containing initialization, condition, and iteration statements, then a block of code in curly braces.*
    01:50 🔄 *The three parts of a for loop in Java are the index declaration (often `int i = 0;`), the condition for continuation (`i = 0`, and decrement the index (`i--`), then print a message like "Happy New Year" outside the loop.*
    03:17 🔄 *You can increment or decrement the index by more than one in a for loop, e.g., `i -= 2` to count down by 2.*
    03:30 🔄 *Optionally, you can move the increment/decrement statement inside the for loop, which functions the same as having it in the initialization part.*

  • @nicacioarruda219
    @nicacioarruda219 Год назад +1

    Amazing free content, the best course that I found on the internet.

  • @GoofyGoober3792
    @GoofyGoober3792 2 года назад +1

    You are a legend and my hero. Am learning java for automation :)

  • @atmatheprophet
    @atmatheprophet Год назад

    Dude thank you so much for this channel and all these lessons.

  • @sergiogarcia-di5nj
    @sergiogarcia-di5nj 2 года назад

    I like the way you're spontaneous while talking bro !!

  • @JuliHoffman
    @JuliHoffman 2 года назад

    You are a lifesaver, Bro!

  • @omaralexis6853
    @omaralexis6853 11 месяцев назад

    passing my java class thanks to you Bro :)

  • @Simis999
    @Simis999 2 года назад +1

    Bite-sized education for the layman citizen

  • @honoredegg
    @honoredegg 2 года назад +2

    "for" loop understood. 13th. Thank you, ma Bro Sensei!

  • @JarvisBaileyVA
    @JarvisBaileyVA 10 месяцев назад

    We're going to get real close over these next 6 months and beyond

  • @Doubl3Shorts
    @Doubl3Shorts Год назад

    Thanks for the tutorial!

  • @nagarajloni6473
    @nagarajloni6473 2 месяца назад +1

    Thanks sir

  • @krebit8899
    @krebit8899 9 месяцев назад

    bruhh i did the whole sylabus in less than 30 mins thank you bro

  • @dogowo
    @dogowo 2 года назад

    thank you, this helped me a lot

  • @patriotkz2308
    @patriotkz2308 24 дня назад

    Thanks, Bro!

  • @danny.3036
    @danny.3036 3 года назад +1

    Thanks, Bro! ☕

  • @elionayzuridasilveira4140
    @elionayzuridasilveira4140 5 месяцев назад

    Thank you👏

  • @JDUBBAU2
    @JDUBBAU2 Год назад

    Bro I’m in a Cisp class and these videos savoring me because I am so lost

  • @ibrahimylmaz8378
    @ibrahimylmaz8378 2 года назад

    you are amazing!

  • @cesara9747
    @cesara9747 2 года назад

    you're a beastttt

  • @nickgavrilis2079
    @nickgavrilis2079 Год назад

    Better explanation than my prof at university

  • @giriprasad5265
    @giriprasad5265 2 года назад

    very informative sir thank you.....

  • @adochan1000
    @adochan1000 3 года назад

    Thanks you for a great job, Bro

  • @chizuruokeonyedim506
    @chizuruokeonyedim506 Год назад

    great content, really helpful

  • @ghoggaliabdou4222
    @ghoggaliabdou4222 3 года назад

    Thank you for the video 💙💙💙💙

  • @曾毓哲-b1t
    @曾毓哲-b1t Год назад

    THANK YOU

  • @neonyoutobe5405
    @neonyoutobe5405 Месяц назад

    For loop: repeting a block of code limited number of times.
    for(counter, condition, increment or decrement){
    BLOCK OF CODE THAT RUNS IF CONDITION IS TRUE
    }
    eg: int i;
    for(i=0;i

  • @BakhtimurodPrimov
    @BakhtimurodPrimov Год назад

    AWESOME

  • @stevewilliams2259
    @stevewilliams2259 3 года назад

    I am the biggest fan of you

  • @Horatius_23
    @Horatius_23 2 года назад

    Thanks! :D

  • @mohammedhero6933
    @mohammedhero6933 2 года назад

    Thankss Broo !!!

  • @wallstreetbets7741
    @wallstreetbets7741 2 года назад

    learnt from you
    again

  • @SAEID-n4r
    @SAEID-n4r Год назад

    ❤❤❤

  • @AcidDaBomb
    @AcidDaBomb Год назад

    using this to pass my java final

  • @bekturasanbekov1979
    @bekturasanbekov1979 Год назад

    thx 4 vid bro !

  • @sairos4057
    @sairos4057 2 года назад

    ty bro

  • @yevgenomelchenko732
    @yevgenomelchenko732 Год назад

    great content

  • @queena594
    @queena594 4 года назад

    Thanks for sharing x

  • @manchester250
    @manchester250 6 месяцев назад

    thank you

  • @ctluwua7695
    @ctluwua7695 3 года назад

    Never Stop Uploading videos Plz

  • @percivalgebashe4376
    @percivalgebashe4376 Год назад

    Nice

  • @erneztoyo
    @erneztoyo 3 года назад

    Great Video!

  • @robertgrzegorczyk531
    @robertgrzegorczyk531 3 года назад

    Great job bro

  • @mohamedelfadli3125
    @mohamedelfadli3125 Год назад

    following you to the end

  • @DucatiSydney
    @DucatiSydney 2 года назад

    Thanks ma bro!

  • @Giovanni-Rhonim
    @Giovanni-Rhonim 8 месяцев назад

    God Bless you Bro +11

  • @alialhussain4139
    @alialhussain4139 4 месяца назад

    Thanks, Bro 06/01/2024

  • @nebilibnbonsa4258
    @nebilibnbonsa4258 2 года назад

    Thanks bro I want to get copies of your codes more and more can I get it?
    Thank you

  • @aditipatil3807
    @aditipatil3807 Год назад

    Thanks

  • @arielkarat4338
    @arielkarat4338 Год назад

    Thanks bro 💯

  • @mariahava7263
    @mariahava7263 2 года назад

    ayo greattttt

  • @huuloc8719
    @huuloc8719 2 года назад

    Nice.

  • @PoorwayTraning
    @PoorwayTraning Год назад

    thanks

  • @rajeevdixit5755
    @rajeevdixit5755 2 года назад

    Very good

  • @matinmonshizadeh
    @matinmonshizadeh 3 года назад

    thanks bro

  • @shivgupy-pt9ig
    @shivgupy-pt9ig Год назад +1

    my dream is to get in faang

  • @baubaudinamo
    @baubaudinamo 3 года назад

    good job

  • @zakilotfi6604
    @zakilotfi6604 3 года назад

    What would happen if you set the second part to null?

  • @salahadinshemsu6186
    @salahadinshemsu6186 Год назад

    Брат спасибо

  • @doonspades6096
    @doonspades6096 Год назад

    yessir

  • @FEG101
    @FEG101 3 года назад +2

    does work for me for some reason it just spams 1 million zero`s

  • @AdrianMarc-ux4wj
    @AdrianMarc-ux4wj Год назад

    Is there a way to make it so that it goes up or down an increment every time the program is run?

    • @AnvithV
      @AnvithV Год назад

      Didn't know what you meant exactly but here is what I came up with and I hope this is what you meant:
      import java.util.Random;
      public class Main {
      public static void main(String[] args) {

      Random random = new Random();
      int i;

      for( i = random.nextInt(11); i>=0;) {
      System.out.println(i);
      break;
      }
      System.out.println("Happy New Year!");
      }
      }
      It will generate a random number between 0 to 10 before saying "Happy New Year!"

  • @abdijr254
    @abdijr254 2 года назад

    How do i find the min and max value on a for loop

  • @subid.majumdar
    @subid.majumdar 2 года назад

    Happy New Year 2022

  • @nicktorius8910
    @nicktorius8910 2 месяца назад

    What do you do when the code keeps running forever? My computer almost crashed because the console kept making more and more numbers infinately

    • @DixeyDo
      @DixeyDo 13 дней назад

      I know I am a month late but in case you ever need it there is a red square in the upper right of the console, click it to stop running

  • @Ahmadzai-15
    @Ahmadzai-15 Год назад

    loop only use for Int Variable ?

  • @azamato
    @azamato 2 года назад

    dropped a comment

  • @alexyakoveno4682
    @alexyakoveno4682 2 года назад

  • @GhostOps300
    @GhostOps300 2 года назад

    Is it necessary for the for loop to be inside braces

  • @marosak8056
    @marosak8056 Год назад

    nice but pls help what is diferent between while (i == 10){i++;} and for(int i; i >=0; i++)

    • @darkpal1339
      @darkpal1339 Год назад

      As far as I know, there isn't any difference. They just make your code more readable, since a person would have a certain understanding of the purpose of your loop just by seeing if it's "for" or "while".

  • @johan-oe9kz
    @johan-oe9kz 2 года назад

    👍

  • @trickysachin
    @trickysachin 2 года назад

  • @honu2980
    @honu2980 2 года назад

    still hanging there and taking notes on google sldies

  • @simik4830
    @simik4830 Месяц назад

    comment for algorithm!

  • @buddhimakaushalya2912
    @buddhimakaushalya2912 2 года назад

    gg

  • @icecryptojt2708
    @icecryptojt2708 3 года назад

    BROOOOOOOOOOOOOOOOOO

  • @Alenie10
    @Alenie10 Месяц назад

    starting 00:22

  • @cornmoss638
    @cornmoss638 3 года назад

    /*Brandon (Insert last name here)
    *March 28, 2021
    *For Loops
    */
    public class ForLoops {
    public static void main(String[] args) {
    for (int i = 0; i = 0; i--) {
    System.out.println(i);
    }
    for (int i = 10; i >= 0; i-=2) {
    System.out.println(i);
    }
    }//end of main
    }//end of class

  • @yeliza2350
    @yeliza2350 2 года назад

    6 february

  • @Gametimewithsurya
    @Gametimewithsurya 2 месяца назад

    BRo is bro

  • @NebyuDaniel-j6b
    @NebyuDaniel-j6b Месяц назад

    Broski

  • @SheilaJoseph-f4h
    @SheilaJoseph-f4h Год назад

    Hi

  • @greeneggsandmushrooms9855
    @greeneggsandmushrooms9855 3 года назад

    three parts to this 4 loop lol

  • @ctluwua7695
    @ctluwua7695 3 года назад

    LOOOOOOOOOOOOOOOPS

  • @bartomiejsniadach5795
    @bartomiejsniadach5795 2 года назад

    Bro

  • @pokeydash3634
    @pokeydash3634 3 года назад

    hello

  • @patrickpasaje4037
    @patrickpasaje4037 3 года назад

    "Video 13"

  • @jlente1216
    @jlente1216 10 месяцев назад

    OHAHA

  • @AARTIKUMARI-fe8wx
    @AARTIKUMARI-fe8wx Год назад

    vedio -13

  • @gamsterilyass2952
    @gamsterilyass2952 4 месяца назад

    bro

  • @melrovynr.aricayos8534
    @melrovynr.aricayos8534 4 года назад

    16

  • @JoshuaWhitie
    @JoshuaWhitie 5 месяцев назад

    G