Java enum 🪐

Поділитися
Вставка
  • Опубліковано 25 лис 2024

КОМЕНТАРІ • 137

  • @BroCodez
    @BroCodez  4 роки тому +67

    enum Planet{
    MERCURY(1),
    VENUS(2),
    EARTH(3),
    MARS(4),
    JUPITER(5),
    SATURN(6),
    URANUS(7),
    NEPTUNE(8),
    PLUTO(9);

    int number;

    Planet(int number){
    this.number = number;
    }
    }
    public class Main {
    public static void main(String[] args) {
    //enum = enumerated (ordered listing of items in a collection)
    //grouping of constants that behave similarly to objects

    Planet myPlanet = Planet.PLUTO;

    canILiveHere(myPlanet);

    }

    static void canILiveHere(Planet myPlanet){

    switch(myPlanet) {
    case EARTH:
    System.out.println("You can live here :)");
    System.out.println("This is planet #"+myPlanet.number);
    break;
    default:
    System.out.println("You can't live here...yet");
    System.out.println("This is planet #"+myPlanet.number);
    break;
    }
    }

    }

    • @Creativeprogrammer237
      @Creativeprogrammer237 3 роки тому

      Very helpful video bro

    • @kageemo
      @kageemo 3 роки тому +1

      hi if i wish to random select a enum how do i go about doing that?

    • @ernestchikuwa9935
      @ernestchikuwa9935 2 роки тому

      make int number final

    • @joyceasante8292
      @joyceasante8292 Рік тому +1

      Practicing...
      enum Day
      {
      MONDAY(1),
      TUESDAY(2),
      WEDNESDAY(3),
      THURSDAY(4),
      FRIDAY(5),
      SATURDAY(6),
      SUNDAY(7);
      int number;
      Day(int number){
      this.number = number;
      }
      }
      public class Main
      {
      public static void main (String[]args)
      {
      Day day = Day.MONDAY;
      workDay (day);
      }
      static void workDay (Day day)
      {
      switch (day)
      {
      case MONDAY:
      case TUESDAY:
      case WEDNESDAY:
      case THURSDAY:
      case FRIDAY:
      System.out.println ("It's a working day.");
      System.out.println("Day number "+day.number);
      break;
      default:
      System.out.println ("It's weekend!");
      System.out.println("Day number "+day.number);
      break;
      }
      }
      }

  • @nikolozlatsabidze
    @nikolozlatsabidze Рік тому +104

    Thank you , my whole village is grateful to you . We watch all your videos together at village center every day if it is not raining

    • @BroCodez
      @BroCodez  Рік тому +36

      that's awesome! Tell everyone I said hi!

    • @Jo70964s
      @Jo70964s Рік тому +6

      lmfaooo

    • @ninopino12
      @ninopino12 10 місяців тому +4

      🤣🤣@@BroCodez

    • @thenermer
      @thenermer 7 місяців тому +2

      Hah I watch them even when it IS raining

  • @spenzr6920
    @spenzr6920 2 роки тому +22

    That "YOURANUS" caught me off-guard lmao, good tutorial btw 👍

  • @koyuki6113
    @koyuki6113 2 місяці тому +2

    It's kinda funny how other yters when they talk about concepts, they completely go around about and you just have to bare watching it. I love how I can just watch your video and instantly understand how something works just because you explain it literally at what it is without extra stuff that isn't needed.

  • @MrRexxarHell
    @MrRexxarHell 2 роки тому +13

    I really like your sense of humor when you teach things, it makes it more fun. Keep it this way!

  • @angelcastineira2561
    @angelcastineira2561 4 роки тому +26

    enum GalicianWeekday{
    LUNS(1),
    MARTES(2),
    MERCORES(3),
    XOVES(4),
    VENRES(5),
    SABADO(6),
    DOMINGO(7);
    int number;
    GalicianWeekday(int number){
    this.number = number;
    }
    }

  • @26.hoangvanminh12
    @26.hoangvanminh12 16 днів тому

    Your channel is so great, I have never seen a lecture in coding but concise and easy to understand like your videos

  • @AlirezaYadegarAzary
    @AlirezaYadegarAzary 8 місяців тому +1

    so much struggling with the concept and finally found your video. Thanks man

  • @mafakka2
    @mafakka2 2 роки тому +8

    well if you consider Australia as a planet then yes, Pluto is a planet too, since its size.equal(Australia)

  • @Vangelis.
    @Vangelis. 4 роки тому +15

    Thank you for your Java tutorials bro. They are really helpful and easy to understand!

  • @insalia8216
    @insalia8216 3 роки тому +25

    Thank you, bro! This was really helpful, especially with a mix of humor in your explanation. I enjoyed watching it while also learning :)

  • @alicialightner7309
    @alicialightner7309 Місяць тому

    thank you so much your videos have been helping me through my college computer science courses!!!!

  • @girl6994
    @girl6994 4 роки тому +9

    I feels I really want to be a English native speaker, it’s so important in learning coding

    • @BroCodez
      @BroCodez  4 роки тому +3

      it helps lol

    • @ottttoooo
      @ottttoooo 3 роки тому

      or you know, you can always invent coding in your language

    • @gilililili
      @gilililili 3 роки тому +2

      @@ottttoooo but they'd have to make it from a programming language in English

    • @formlessavatar5220
      @formlessavatar5220 3 роки тому +1

      Very true lol. Oh, and Sanskrit would probably help too haha

  • @rivazmardani
    @rivazmardani 2 роки тому +3

    he's officially become the new lord & saviour on java cult😁
    thx bruh it's rly helpfull

  • @iyar220
    @iyar220 Рік тому

    You are one of the most helpful people on youtube!

  • @abdulrahmanfattal5140
    @abdulrahmanfattal5140 2 роки тому +2

    Man, you are the best. I always watch your videos to learn new languages and you make it really easy. Keep it going 👍🏻👍🏻.

  • @ВалерійЛуцьо-и6о
    @ВалерійЛуцьо-и6о 2 роки тому

    Best Java tutorials are on this channel! Thanks, Bro!

  • @faizalimuhammadzoda4731
    @faizalimuhammadzoda4731 2 роки тому

    Thanks for sharing. I like all of your videos.

  • @hugoresende5620
    @hugoresende5620 2 роки тому +5

    enum Planetas {
    MERCURIO(1),
    VENUS(2),
    TERRA(3),
    MARTE(4),
    JUPITER(5),
    SATURNO(6),
    URANUS(7),
    NEPTUNO(8),
    PLUTÃO(9);
    int num;
    Planetas(int n){
    this.num = n;
    }
    }
    public class Main {
    public static void main(String[] args) {
    //instanciação de enum
    Planetas meuPlaneta1 = Planetas.TERRA;
    Planetas meuPlaneta2 = Planetas.MARTE;
    Planetas meuPlaneta3 = Planetas.NEPTUNO;
    Planetas meuPlaneta4 = Planetas.PLUTÃO;
    System.out.print("Planeta 1--> ");
    habitavel(meuPlaneta1);
    System.out.print("Planeta 2--> ");
    habitavel(meuPlaneta2);
    System.out.print("Planeta 3--> ");
    habitavel(meuPlaneta3);
    System.out.print("Planeta 4--> ");
    habitavel(meuPlaneta4);
    }
    static void habitavel(Planetas p){
    switch (p){
    case TERRA:
    System.out.println("PODE HABITAR AQUI");
    System.out.println("PLANETA #" + p.num);
    break;
    case MARTE:
    System.out.println("Chance de viver aqui");
    System.out.println("PLANETA #" + p.num);
    break;
    default:
    System.out.println("Não habitável");
    System.out.println("PLANETA #" + p.num);
    break;
    }
    }
    }

  • @Bdbdjdidnbwk
    @Bdbdjdidnbwk 9 місяців тому

    Thank you bro for such a clearly explaining.

  • @blabberq
    @blabberq 2 роки тому +1

    Your sense of humor just gets me xd

  • @MoSi-v6z
    @MoSi-v6z Рік тому

    The YOURANUS joke got me haha, your dry humor is quite funny

  • @SatrixPlaysGames
    @SatrixPlaysGames 2 роки тому

    My first time here, loved the tutorial! I like your humor.

  • @kartikbishnoi9893
    @kartikbishnoi9893 2 роки тому

    Great

  • @mirlsgrabbaszad594
    @mirlsgrabbaszad594 6 місяців тому

    Perfect as always

  • @chizuruokeonyedim506
    @chizuruokeonyedim506 2 роки тому

    great content

  • @krutikabarad4241
    @krutikabarad4241 Рік тому

    Bro you are hella funny without even trying

  • @gaurav9362
    @gaurav9362 3 роки тому +3

    package enums.java;
    enum Fruits{
    APPLE(100),MANGO(101),BANANA(102),LEMON(103),KURKURE(104),PUFF(500),PAPER(505);

    int number;
    Fruits(int no){
    this.number=no;
    }
    }
    public class EnumEration {
    public static void main(String[] args) {
    //enum = enumerated (ordered listing of items in a collection)
    //grouping of constants that behave similarly to objects

    Fruits myfruit=Fruits.KURKURE;
    iWilleat(myfruit);
    }

    static void iWilleat(Fruits kela) {
    switch(kela) {
    case APPLE:
    System.out.println("I will cut it");
    System.out.println("The number is"+kela.number);
    break;
    default:
    System.out.println("I will do any thing rather cutting");
    System.out.println("The number is :"+kela.number);
    break;

    }
    }
    }

  • @zed5551
    @zed5551 2 роки тому

    Great intro tutorial to enum.

  • @eugenezuev7349
    @eugenezuev7349 5 місяців тому

    Thank you for you

  • @semilife
    @semilife 2 роки тому +1

    enum Planet
    {
    MERCURY(1,"rocky"),
    VENUS(2,"rocky"),
    EARTH(3,"rocky"),
    MARS(4,"rocky"),
    JUPITER(5,"gas"),
    SATURN(6,"gas"),
    URANUS(7,"gas"),
    NEPTUNE(8,"gas"),
    PLUTO(9,"rocky");
    int number;
    String planetType;
    Planet(int number, String planetType)
    {
    this.number = number;
    this.planetType = planetType;
    }
    }

  • @King.GeorgeM
    @King.GeorgeM 2 роки тому

    Very good

  • @alyssapuype732
    @alyssapuype732 6 місяців тому

    Very good video!

  • @Ragehunter
    @Ragehunter Рік тому

    4:59 THANK YOU VERY MUCH BRO NOW I SOLVE THIS

  • @ChosenInvisiball
    @ChosenInvisiball 7 місяців тому +1

    "Come on elon what's taking so long" Oh boy did this age like milk

  • @FarukqO
    @FarukqO Рік тому

    Appreciate the hard work Bro Code

  • @ahsanshahzad610
    @ahsanshahzad610 2 роки тому

    great

  • @kemann3815
    @kemann3815 3 роки тому

    Awesome

  • @percivalgebashe4376
    @percivalgebashe4376 Рік тому

    Nice

  • @19hectorm
    @19hectorm 2 роки тому

    enum Ocean{
    PACIFIC(1),
    ATLANTIC(2),
    ARTIC(3),
    INDIC(4),
    ANTARTIC(5)
    int number;
    Ocean (int number){
    this.number=number;
    }
    }

  • @aaronlambert8151
    @aaronlambert8151 Рік тому

    Thanks for yet another great video. ❤

  • @renemendy4880
    @renemendy4880 2 роки тому

    Thanks

  • @_I_LOVE_CHOCOLATE_
    @_I_LOVE_CHOCOLATE_ Рік тому

    This video is awesome!!

  • @DetCoAnimeFan
    @DetCoAnimeFan 3 роки тому +1

    enum Subjects
    {
    ENGLISH_LIT,
    ENGLISH_LANG,
    HINDI,
    COMPUTER_SCIENCE,
    PHYSICS,
    CHEMISTRY,
    MATHS;
    }

  • @obzdg9953
    @obzdg9953 2 роки тому

    showing next level is a good idea, thank you bro. Will you upload more videos? what should we do after your videos?

  • @unlockme1424
    @unlockme1424 3 роки тому

    Gracias bro

  • @AdekunleJimoh-e1v
    @AdekunleJimoh-e1v Рік тому

    Thank you

  • @bestlistener1
    @bestlistener1 Рік тому

    enum Week{
    SUNDAY(0),
    MONDAY(1),
    TUESDAY(2),
    WEDNESDAY(3),
    THURSDAY(4),
    FRIDAY(5),
    SATURDAY(6) ;
    int number;
    Week(int number){
    this.number =number;
    }
    }

  • @patrik6775
    @patrik6775 Рік тому

    enum Color {
    RED(1),
    GREEN(2),
    BLUE(3),
    int number;
    Color(int number){
    this.number = number;
    }
    }

  • @parsava_localize
    @parsava_localize 11 місяців тому

    Perfect!

  • @angelrpozas6736
    @angelrpozas6736 Рік тому

    Great video!

  • @leangsengly2876
    @leangsengly2876 Рік тому

    thank you

  • @andrewfog2466
    @andrewfog2466 Рік тому

    cool

  • @changyou4454
    @changyou4454 3 роки тому

    Dropping a comment.

  • @jackwolf5663
    @jackwolf5663 Рік тому

    THANK YOU Bro))))

  • @saibadam
    @saibadam 3 роки тому

    Dropping a comment

  • @ahmetkarakartal9563
    @ahmetkarakartal9563 3 роки тому

    thank you so much

  • @mackensonreginaldmichel399
    @mackensonreginaldmichel399 2 роки тому

    Thanks a lot. What if we wanted to put it in a constructor ? How would that be done? Thanks again.

  • @MO-dd3cs
    @MO-dd3cs 4 роки тому +1

    Thank you ♡

  • @NichtAnwesend
    @NichtAnwesend 9 місяців тому

    du hast mich nicht enttäuscht :)

  • @Mal-nf2sp
    @Mal-nf2sp 2 роки тому

    I love how the music of this tutorial is like a minecraft video🤣

  • @Alibeee87
    @Alibeee87 3 роки тому

    Thanks bro

  • @Fabian008
    @Fabian008 Рік тому

    Thank you bro!

  • @nawfalnjm5699
    @nawfalnjm5699 3 роки тому

    thank you , your videos are awesome !

  • @yuvalmorami1020
    @yuvalmorami1020 Рік тому

  • @sanskarsongara2592
    @sanskarsongara2592 3 роки тому +1

    2:56 I pray musk hear you soon :-)

  • @deepdaddy1208
    @deepdaddy1208 4 роки тому

    Yes bro

  • @alegamer-uw2zp
    @alegamer-uw2zp Рік тому

    public enum Membership {
    PLATINUM,
    GOLD,
    SILVER,
    BLUE,
    RED;
    public String toString(){
    switch(this)
    {
    case PLATINUM:
    return "Platinum" ;
    case GOLD:
    return "Gold";
    case SILVER:
    return "Silver";
    case BLUE:
    return "Blue";
    case RED:
    return "Red";
    default:
    return "Unknown";
    }
    }
    }

  • @chungfup1493
    @chungfup1493 Рік тому

    I am going through Enums that were introduced in Java 1.5. In Effective Java 2'nd Edition it's mentioned that before Java 1.5 there were int and String enum patterns which were having some deficiencies.
    I understood the cons of int enum patterns but while going through String enum patterns I got the basic idea but didn't get the deep sense of below statements mentioned under Item30 in Effective Java:
    This variant, known as the String enum pattern, is even less desirable. While it does provide printable strings for its constants, it can lead to performance problems because it relies on string comparisons. Worse, it can lead naive users to hard-code string constants into client code instead of using field names. If such a hard-coded string constant contains a typographical error, it will escape detection at compile time and result in bugs at runtime.
    Can anyone help me in understanding what these lines explaining. I would appreciate if it can be explained with some code snippet.
    Thanks

  • @zari_723
    @zari_723 2 роки тому

    great soundtrack xD

  • @danielmilewski7659
    @danielmilewski7659 2 роки тому

    thanks bro!

  • @jonathansutanto2033
    @jonathansutanto2033 3 роки тому

    omg very useful to me,thanks :D

  • @manuelgonzalezpalafox2627
    @manuelgonzalezpalafox2627 2 роки тому

    Ly bro 4

  • @Healthyroutines.
    @Healthyroutines. 4 роки тому

    thank bro

  • @TheFlyingSquirrel630
    @TheFlyingSquirrel630 4 місяці тому

    I’ve been on the run for over 4 years now…

  • @Soul93724
    @Soul93724 6 місяців тому

    🎉🎉🎉🎉

  • @enfieldli9296
    @enfieldli9296 2 роки тому

    Tell me why you are so cool bro

  • @user-vh3lm3qo4t
    @user-vh3lm3qo4t 3 роки тому

    One for the algorithm

  • @joaoluis3042
    @joaoluis3042 2 роки тому

    "Youranus" ... I'm dead ^^

  • @nehalayaaz9406
    @nehalayaaz9406 4 роки тому

    🌸

  • @nouraldinurfan5024
    @nouraldinurfan5024 3 місяці тому

    thank you but how often do we need to use enum.

  • @surajrao8251
    @surajrao8251 5 місяців тому

    pluto is a planet

  • @developerjunior446
    @developerjunior446 3 роки тому

    Like!

  • @JeongwooMog
    @JeongwooMog Рік тому

    are enums pretty much objects? are they arrays? or sets?

  • @tcbj2003
    @tcbj2003 2 роки тому

    thanks gigachad

  • @hermitmobile1742
    @hermitmobile1742 3 роки тому

    youtube algorithm prayer

  • @kapebreak
    @kapebreak Рік тому

    lets deafeat the mighty algorithm

  • @thelastdiver3228
    @thelastdiver3228 6 місяців тому

    this is for Bro !! :)

  • @AG-qp7gn
    @AG-qp7gn 3 роки тому

    enum

  • @barknbryce6993
    @barknbryce6993 3 роки тому

    Pluto

  • @ginasomara267
    @ginasomara267 3 роки тому

    #defeat the algorithm

  • @sp3ct3r71
    @sp3ct3r71 3 роки тому

    youranas:)

  • @kemann3815
    @kemann3815 3 роки тому

    Ive been thinking about a constant list but i cant think of one ffs lol guess ima go to jail then ...

    • @BroCodez
      @BroCodez  3 роки тому +1

      run! The police are coming for you!

  • @danielmilewski7659
    @danielmilewski7659 2 роки тому

    comment for stats, thanks!

  • @Snowmanver2
    @Snowmanver2 2 роки тому

    oh, no, not the police 😬

  • @Healthyroutines.
    @Healthyroutines. 4 роки тому

    the Third

  • @dsire159
    @dsire159 3 роки тому

    an enum

  • @barbosa17
    @barbosa17 Рік тому

    URANUS

  • @BlazingRex
    @BlazingRex Рік тому

    public enum Gigachad {
    MUSCULAR,
    SHREDDED,
    KNOWS_CODE,
    CHISSELED,
    IS_NAMED_BRO_CODE,
    OVER_9000
    }
    pls don't call the po po😂

  • @lezgitransformer
    @lezgitransformer 3 роки тому

    "If you don't I'm calling the police" like this line :D