15.5 enum in Java part 1 | Basics

preview_player
Показать описание
In this video we will see :
- Basics of enum
- Life before enum
- How to create enum
- Difference between enum of Java and enum in other language

An enum type is a special data type that enables for a variable to be a set of predefined constants.
The variable must be equal to one of the values that have been predefined for it.
Common examples include compass directions (values of NORTH, SOUTH, EAST, and WEST) and the days of the week.
Because they are constants, the names of an enum type's fields are in uppercase letters.
In the Java programming language, you define an enum type by using the enum keyword

Check out our courses:

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO20 (20% Discount)

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

Wonderful explanation... just one request...kindly summarize the video for 30 -50 sec when you're about to complete or once its completed..that will be helpful.
Thanks

rajeshchouhan
Автор

I really enjoy all your videos! You make it understandable.

prathibaanand
Автор

 Can we declare an enum private?
 Can we define an enum inside any block in a class?
 Can we define multiple enums inside same class?

bluehathacker
Автор

what is the need of enum when we have final keyword for declaring constants? pls answer...

AGOUDUVIMALKEERTHI
Автор

6.10 : compiler is giving you some bad wordss.. xD xD

joshinim.n
Автор

My mans said apple constant is by default final in an interface? Am I missing on something here?

paulabhishek
Автор

i have a question
what if we want to return some value for exam if i call a constant it should return a value
i think we should declare "final static variables" declare and define the value together then they can be treated as constant

ritikshrivastava
Автор

Compiler gives some bad words... Haha

vinothkumar-mcsi
Автор

Sir i have written the same program but its showing some error in eclipse.what's the problem?

ayushbagwari
Автор

sir suggest me some best book for core and advance java.

rishavbhardwaj
Автор

Is it necessary to give the constants name in upper case?

anchitbhushan
Автор

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

chungfup
Автор

Sir please tell me in spring how dto call this enum

vrushalipatil
Автор

can you pls explain if i have enum tetrominoe a variable and if i again write private tetrominoe pieceShape. do by writing tetromine it assign pieceShape variable enum type vale

diptanshutripathi
Автор

Please can you increase the font size of ur PC

vijayaiyappa