Java if statements 🚧【6 minutes】

Поделиться
HTML-код
  • Опубликовано: 19 окт 2024

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

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

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

    // if statement = performs a block of code if it's condition evaluates to be true

    int age = 75;

    if(age==75) {
    System.out.println("Ok Boomer!");
    }
    else if(age>=18) {
    System.out.println("You are an adult!");
    }
    else if(age>=13) {
    System.out.println("You are a teenager!");
    }
    else {
    System.out.println("You are not an adult!");
    }

    }
    }

  • @tankgirlsc
    @tankgirlsc Год назад +33

    You have explained things so much better than my coding instructor! There has never been an explanation as to "why" such operations are used, and how they can be used incorrectly, take for example the one equal sign as an assigned vs the two equal signs to compare. Now I know why my code spat out a bunch of errors. You just got yourself a subscriber sir!

    • @mr.phewphew4971
      @mr.phewphew4971 8 месяцев назад

      Oh my god you are wasting money on that proof

  • @trodg
    @trodg 2 года назад +43

    my prof struggled to explain this to us today and you did it in 6 minutes in such a clear way

    • @TheDuckter
      @TheDuckter 9 месяцев назад +2

      how 💀
      but yeah i agree

    • @shift-g3l
      @shift-g3l 2 месяца назад +2

      whuh

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

      how is that possible?💀

  • @rohitbharatbhandwalkar8583
    @rohitbharatbhandwalkar8583 2 года назад +11

    I can't wait to get to the more complicated stuff and witness how Bro Code makes it a cake walk

  • @davidbolduc4378
    @davidbolduc4378 3 года назад +114

    I wish Bro Code was my professor

  • @antwoinesmith4650
    @antwoinesmith4650 Год назад +5

    Your explanations are so good, thanks. I'm new to coding and when I need a quick refresher on something I know where to come to.

  • @marioshusband3700
    @marioshusband3700 4 года назад +30

    finally, after all these episodes, you make an if statement tutorial

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

      haha it's a remake tho

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

      @@BroCodez what is the illegal character 200f or something like that

  • @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

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

    We learned if and else if statements in my Java Bootcamp, but this explained them much better. Thanks!

  • @josephthecreator
    @josephthecreator 2 года назад +5

    This video gave me the missing piece to complete my assignment, thanks Bro! 💯

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

    I have a class test in exactly 20 minutes. And bro actually saved my life. Thank you i owe my life to you

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

    bro is too good he explained the whole thing in 6 min

  • @reginaldthaddeuscadiao3488
    @reginaldthaddeuscadiao3488 6 дней назад

    This will help me for my mid term exams later :)

  • @Curious_Clover
    @Curious_Clover 8 месяцев назад

    "Ok Boomer!"
    I was caught off guard there buddy. I almost laughed in the middle of the night.

  • @ganyu5768
    @ganyu5768 3 месяца назад

    all your videos are really great Brev. really cool :0 it helps me to learn java again with interest.

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

    Thank you brother for all of your work.

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

    How come I havent seen you before. Thanks a lot man! you help me greatly.!

  • @alexanderperez3974
    @alexanderperez3974 16 дней назад

    Best channel ever!

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

    You are real bro, thanks for the helpful video again ;)

  • @melissaruth1000
    @melissaruth1000 8 месяцев назад

    your videos are so so good. thanks for your help

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

    So, else statement. I've done with Scanner, learned from you. 9th. Thank you, ma Bro Sensei!

  • @justsomeordinarykid923
    @justsomeordinarykid923 3 года назад +1

    Coming from knowing java script I now know they both have java in the name. Even for loops work the same.

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

    Thank you!!! now it makes sense.

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

    Thanks for your tutorial.

  • @ewawojciech-bu3be
    @ewawojciech-bu3be 6 месяцев назад

    Thank you for this !

  • @technicalresi5451
    @technicalresi5451 8 месяцев назад

    Thank you so much bro very nice 😊❤

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

    bros for life and thanks for the playlist

  • @RahmatullahVahdatWithCod-pl2vh
    @RahmatullahVahdatWithCod-pl2vh 3 месяца назад

    Thank you brother thank you if you need money allah give U A Billuner .!!!

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

    KAKASHI AFTER RETIREMENT AS HOKAGE 🚶🏻🧙 LOL BRO KEEP IT UP .

  • @Garrison86
    @Garrison86 3 года назад +1

    Amazing! Thanks Bro

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

    Smashed subscribed button Bro!! liked your way of teaching and accent. :)

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

    Hello! What website/app are you using for coding?

  • @FFax.annime
    @FFax.annime Месяц назад

    @BroCodez is it wrong to write
    The value before the variable in the if statement for example
    If( 20>iage)

  • @MRTOP-nu8dn
    @MRTOP-nu8dn Год назад

    thx you helped so muchh😀

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

    Scanner method:
    import java.util.Scanner;
    public class Main{
    public static void main(String[] args) {

    Scanner scannerr = new Scanner(System.in);

    System.out.print("What's your age?");
    int age = scannerr.nextInt();

    if (age >= 70) {
    System.out.println("You're an elder! It would be cool if you choose not to drive");

    } else if (age >= 18){
    System.out.println("You can drive little boy");

    } else {
    System.out.println("You can't drive until you reach the reach the age 18 y/o");

    }

    // ~~~~scanner end~~~~
    scannerr.close();
    }
    }

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

      Thank you so much bro I love you, if i could kiss you right now i would.

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

      Thanks! I was Struggling how to take number from user!

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

    Thank you!

  • @ljaykhan520
    @ljaykhan520 8 месяцев назад

    Great tutorial bro

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

    amazing job, bro!

  • @erickayusi9449
    @erickayusi9449 4 года назад +1

    I noticed you deleted the char and string topic in the playlist?

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

    Thank you again 💙💙

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

    Awesome Sauce!

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

    GUI method:
    import javax.swing.JOptionPane;
    public class Main{
    public static void main(String[] args) {

    int age = Integer.parseInt(JOptionPane.showInputDialog("What's your age?"));

    if (age >= 18) {
    JOptionPane.showMessageDialog(null, "You can drive!");
    } else {
    JOptionPane.showMessageDialog(null, "You can't drive!");
    }
    }

    }

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

    Great video

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

    Thank you👍

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

    you are amazing!

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

    thank bro very much

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

    thx 4 vid bro

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

    I like your video

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

    Love you bro!

  • @HexaBinary-i5
    @HexaBinary-i5 Месяц назад

    Your voice sounds exactly like Technoblade! : )

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

    Thank you bro

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

    The best!!

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

    Thanks bro!

  • @PhilipNoel-j2p
    @PhilipNoel-j2p 16 дней назад

    thanks!!

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

    Good video !!!!

  • @skipanimations9837
    @skipanimations9837 3 месяца назад

    Thanks Bro

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

    I made a coin flip
    code:
    import java.util.Random;
    public class Main {
    public static void main(String[] args) {
    Random random = new Random();
    int x = random.nextInt(2)+1;
    if(x==1){
    System.out.println("Heads");
    }
    else {
    System.out.println("Tails");
    }
    }
    }

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

    TY BRO

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

    Thank you bro)

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

    Thanks

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

    Thank you

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

    Thank!

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

    why is it saying "C:\Users\ok\OneDrive\Documents\main.java:1: error: class Main is public, should be declared in a file named Main.java
    public class Main {
    ^
    1 error
    Tool completed with exit code 1"

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

    Nice bro!

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

    Thank you Chad

  • @㐥㐥㐥㐥㐥㐥㐥㐥㐥㐥

    One question: If your age is 19, You are a teenager or an adult?

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

    Professor Bro Code to the rescue

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

    thx! learnt

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

    ty bro

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

    Programmer: "int age;"
    Me, a intergalactic eldritch monstrosity who just turned 2,147,483,648 years old: 😢

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

    thanks

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

    for me the code dosnt work, it just repeat the number i input and dosnt even ask me the question
    Syntax Error: invalid syntax
    file "" line 1
    ^
    how do i fix this?

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

    Ακόμα ένα καλό video για τη γλώσσα Java.

  • @JustineRamirez-i9w
    @JustineRamirez-i9w Год назад

    amazing

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

    God Bless you Bro + 6

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

    in 3:13 why it didn't print the bode of if and the body of else if is it because of the curly braces ?

  • @MaricarManiti-x2b
    @MaricarManiti-x2b Год назад

    Is it possible to join both if statement and switch case?

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

    Like your didactics

  • @waldeirmachado7127
    @waldeirmachado7127 7 дней назад

    tks bro

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

    what if you have multiple if statements

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

    dropping a comment for the youtube algorhitm

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

    I f I watch this video, I will learn how to deal with if. If not, than not. :)

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

    i cant seem to run it, the last "}" says "Syntax error , insert "}" to complete Classbody"

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

    Nice

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

    nice bro

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

    Nice.

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

    I love u bro

  • @eddyfromduolingo3587
    @eddyfromduolingo3587 9 месяцев назад +1

    what a chad🗿

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

    Great job!!!
    Var x= y;
    If ( ) { Sys..( ); }
    Else if ( ) { Sys... ( ); }
    Else if ( ) { Sys...( ); }

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

    import java.util.Scanner;
    public class main {
    public static void main(String[] args) {

    int age;

    Scanner scanner = new Scanner(System.in);

    System.out.println("Enter your age :");
    age= scanner.nextInt();

    if(age>=18) {
    System.out.println("You are an adult!");
    }
    else {
    System.out.println("You are not an adult1");
    }

    }
    }

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

      Don't forge to close the Scanner, bro.
      scanner.close(); or Scanner.close(); I don't remember lol

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

    this one just to defeat the algorithm

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

    your jokes are funny

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

    Thanks Bro, 05/31/2024

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

    maybe I should stop going to college school and should watch your video instead....

  • @mojeebullahazami2676
    @mojeebullahazami2676 3 года назад +1

    Random comment :)

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

    "ok boomer" I explode jajajajaja

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

    cool

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

    hey bro!

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

    👍

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

    great video brother