Java enum 🪐

preview_player
Показать описание
Java enums tutorial explained

#java #enums #tutorial
Рекомендации по теме
Комментарии
Автор

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;
}
}

}

BroCodez
Автор

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 <3

nikolozlatsabidze
Автор

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

spenzr
Автор

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

MrRexxarHell
Автор

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

insalia
Автор

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.

koyuki
Автор

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

Vangelis.
Автор

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

xoevjfh
Автор

enum GalicianWeekday{
LUNS(1),
MARTES(2),
MERCORES(3),
XOVES(4),
VENRES(5),
SABADO(6),
DOMINGO(7);

int number;

GalicianWeekday(int number){
this.number = number;
}
}

angelcastineira
Автор

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

mafakka
Автор

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

abdulrahmanfattal
Автор

he's officially become the new lord & saviour on java cult😁

thx bruh it's rly helpfull

rivazmardani
Автор

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

girl
Автор

You are one of the most helpful people on youtube!

iyar
Автор

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

ebyzoss
Автор

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

vmbtcqy
Автор

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

SatrixPlaysGames
Автор

Thanks for sharing. I like all of your videos.

faizalimuhammadzoda
Автор

Thank you bro for such a clearly explaining.

Bdbdjdidnbwk
Автор

Bro you are hella funny without even trying

krutikabarad