YouTube Link: https://youtu.be/LYRDMfJ9OwA
**Java, J2EE & SOA Certification Training - https://www.edureka.co/java-j2ee-trai... **
This Edureka video on Java Enum Tutorial will provide you with detailed knowledge about Enumeration in Java along with real times examples for better understanding. This informative video will include the following.
Agenda
What is Enum?
Why we need Enum?
Differences between Class and Enum
Syntax of Enum
Practical Examples of Enum
Advantages of using Enum
Enum Usecase: Rock Paper Scissor Game
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
2. WHY DO WE NEED ENUMERATION?
DIFFERENCES BETWEEN ENUM AND CLASS
www.edureka.co
WHAT IS ENUMERATION IN JAVA?
PRACTICL EXAMPLES OF ENUM
ADVANTAGES OF ENUM
ENUM USECASE: ROCK PAPER SISSIOR GAME.
4. WHAT IS ENUMERATION?
www.edureka.co
Java Enums are classes that have a fixed set of constants or
variables that do not tend to change. The enumeration in Java is
achieved using the keyword enum. The Java enum Constants
are static and final implicitly.
6. WHY DO WE NEED ENUMERATION?
Thurs Fri SatMon Tue Wed Sun
www.edureka.co
7. WHY DO WE NEED ENUMERATION?
Thurs Fri Satenum week Mon Tue Wed Sun
www.edureka.co
8. WHY DO WE NEED ENUMERATION?
Contract Temporary Permanent
www.edureka.co
9. WHY DO WE NEED ENUMERATION?
Contract Temporary Permanentenum job
www.edureka.co
10. switch (c) {
case 1: one(); break;
case 2: two(); break;
case 3: three(); break;
default: throw Exception;
}
www.edureka.co
11. private static int ONE = 1;
private static int TWO = 2;
private static int THREE = 3;
switch (c) {
case ONE: one(); break;
case TWO: two(); break;
case THREE: three(); break;
default: throw Exception;
}
www.edureka.co
12. enum Action {
ONE { @Override public void action() { } },
TWO { @Override public void action() { } },
THREE { @Override public void action() { } },
public abstract void action();
}
Abstract Method
www.edureka.co
13. enum Action {ONE, TWO, THREE}
Action a = ...
switch (a) {
case ONE: one(); break;
case TWO: two(); break;
case THREE: three(); break;
default: throw Exception;
}
www.edureka.co
29. Enum can implement Interfaces
Enum has fields, methods and constructors
Enum can be traversed.
Enum is easily usable in Switch Cases.
Enum in Java improves Type-Safety.
ADVANTAGES OF ENUM
www.edureka.co