SlideShare a Scribd company logo
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
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.
WHAT IS ENUMERATION?
www.edureka.co
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.
WHY DO WE NEED ENUMERATION?
www.edureka.co
WHY DO WE NEED ENUMERATION?
Thurs Fri SatMon Tue Wed Sun
www.edureka.co
WHY DO WE NEED ENUMERATION?
Thurs Fri Satenum week Mon Tue Wed Sun
www.edureka.co
WHY DO WE NEED ENUMERATION?
Contract Temporary Permanent
www.edureka.co
WHY DO WE NEED ENUMERATION?
Contract Temporary Permanentenum job
www.edureka.co
switch (c) {
case 1: one(); break;
case 2: two(); break;
case 3: three(); break;
default: throw Exception;
}
www.edureka.co
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
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
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
DIFFERENCES BETWEEN CLASS AND ENUM
www.edureka.co
DIFFERENCES BETWEEN CLASS AND ENUM
Class Constants can be overridden
Enum constants cannot be overridden
www.edureka.co
Classes support the creation of Objects
Enum cannot support the creation of objects
DIFFERENCES BETWEEN CLASS AND ENUM
www.edureka.co
Classes can extend other classes
Enum cannot extend other classes
DIFFERENCES BETWEEN CLASS AND ENUM
www.edureka.co
Classes can implement Interface
Enum can implement Interface
DIFFERENCES BETWEEN CLASS AND ENUM
www.edureka.co
SYNTAX FOR ENUM IN JAVA
www.edureka.co
enum syntax:
enum edureka{constants}
PRACTICAL EXAMPLES OF ENUM
www.edureka.co
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
DEFINING ENUM
www.edureka.co
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
ENUM SWITCH CASE
www.edureka.co
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
INHERITANCE IN ENUM
www.edureka.co
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
ENUM WITH CUSTOMIZED VALUES
www.edureka.co
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
ENUM WITH IF-ELSE
www.edureka.co
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
ENUM METHODS
www.edureka.co
ADVANTAGES OF ENUM
www.edureka.co
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
ENUM USECASE: ROCK PAPER SISSORS GAME
www.edureka.co
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
www.edureka.co
Ad

Recommended

enums
enums
teach4uin
 
JAVA AWT
JAVA AWT
shanmuga rajan
 
Arrays in Java
Arrays in Java
Naz Abdalla
 
Java swing
Java swing
Apurbo Datta
 
Arrays in python
Arrays in python
moazamali28
 
Constructor in java
Constructor in java
Pavith Gunasekara
 
Delegates and events in C#
Delegates and events in C#
Dr.Neeraj Kumar Pandey
 
Lecture-1: Introduction to web engineering - course overview and grading scheme
Lecture-1: Introduction to web engineering - course overview and grading scheme
Mubashir Ali
 
Java string handling
Java string handling
Salman Khan
 
Arrays in Java
Arrays in Java
Abhilash Nair
 
Generics
Generics
Ravi_Kant_Sahu
 
Java awt (abstract window toolkit)
Java awt (abstract window toolkit)
Elizabeth alexander
 
Active x control
Active x control
Amandeep Kaur
 
C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#
Dr.Neeraj Kumar Pandey
 
Java abstract class & abstract methods
Java abstract class & abstract methods
Shubham Dwivedi
 
Presentation on-exception-handling
Presentation on-exception-handling
Nahian Ahmed
 
Data Types & Variables in JAVA
Data Types & Variables in JAVA
Ankita Totala
 
Java package
Java package
CS_GDRCST
 
Classes, objects in JAVA
Classes, objects in JAVA
Abhilash Nair
 
android menus
android menus
Deepa Rani
 
Java Tokens
Java Tokens
Madishetty Prathibha
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
I/O Streams
I/O Streams
Ravi Chythanya
 
Ajax presentation
Ajax presentation
Bharat_Kumawat
 
OOP java
OOP java
xball977
 
Files in java
Files in java
Muthukumaran Subramanian
 
Functional programming
Functional programming
ijcd
 
Abstract class in java
Abstract class in java
Lovely Professional University
 
Lecture 6 Enumeration in java ADVANCE.pptx
Lecture 6 Enumeration in java ADVANCE.pptx
AbdulHaseeb956404
 
05a-enum.ppt
05a-enum.ppt
MuthuMs8
 

More Related Content

What's hot (20)

Java string handling
Java string handling
Salman Khan
 
Arrays in Java
Arrays in Java
Abhilash Nair
 
Generics
Generics
Ravi_Kant_Sahu
 
Java awt (abstract window toolkit)
Java awt (abstract window toolkit)
Elizabeth alexander
 
Active x control
Active x control
Amandeep Kaur
 
C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#
Dr.Neeraj Kumar Pandey
 
Java abstract class & abstract methods
Java abstract class & abstract methods
Shubham Dwivedi
 
Presentation on-exception-handling
Presentation on-exception-handling
Nahian Ahmed
 
Data Types & Variables in JAVA
Data Types & Variables in JAVA
Ankita Totala
 
Java package
Java package
CS_GDRCST
 
Classes, objects in JAVA
Classes, objects in JAVA
Abhilash Nair
 
android menus
android menus
Deepa Rani
 
Java Tokens
Java Tokens
Madishetty Prathibha
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
I/O Streams
I/O Streams
Ravi Chythanya
 
Ajax presentation
Ajax presentation
Bharat_Kumawat
 
OOP java
OOP java
xball977
 
Files in java
Files in java
Muthukumaran Subramanian
 
Functional programming
Functional programming
ijcd
 
Abstract class in java
Abstract class in java
Lovely Professional University
 

Similar to Enumeration in Java Explained | Java Tutorial | Edureka (20)

Lecture 6 Enumeration in java ADVANCE.pptx
Lecture 6 Enumeration in java ADVANCE.pptx
AbdulHaseeb956404
 
05a-enum.ppt
05a-enum.ppt
MuthuMs8
 
21CS642 Module 1 Enumerations PPT.pptx VI SEM CSE 2021 Batch Students
21CS642 Module 1 Enumerations PPT.pptx VI SEM CSE 2021 Batch Students
VENKATESHBHAT25
 
c# Enumerations
c# Enumerations
Micheal Ogundero
 
QSpiders - Enum Java Topic
QSpiders - Enum Java Topic
Qspiders - Software Testing Training Institute
 
Effective Java - Enum and Annotations
Effective Java - Enum and Annotations
Roshan Deniyage
 
8enum in c#
8enum in c#
Sireesh K
 
Java enum
Java enum
Sujit Kumar
 
Enum - Coding Guidelines
Enum - Coding Guidelines
kleinron
 
Java essence part 1
Java essence part 1
HanRu Yeh
 
Enumerated data types
Enumerated data types
Ankit Sinha
 
C programming enumeration
C programming enumeration
Kaushal Kumar
 
Enum
Enum
zindadili
 
Diving in OOP (Day 6): Understanding Enums in C# (A Practical Approach)
Diving in OOP (Day 6): Understanding Enums in C# (A Practical Approach)
Akhil Mittal
 
Enumration datatype
Enumration datatype
Mudassir Khan
 
Enumeration In JAVA
Enumeration In JAVA
UMANGCHAUDHARY21
 
ENUM - make u r names as data types
ENUM - make u r names as data types
Ajay Chimmani
 
Evolution and Examples of Java Features, from Java 1.7 to Java 22
Evolution and Examples of Java Features, from Java 1.7 to Java 22
Yann-Gaël Guéhéneuc
 
Enumerations in java.pptx
Enumerations in java.pptx
Srizan Pokrel
 
Tiger: Java 5 Evolutions
Tiger: Java 5 Evolutions
Marco Bresciani
 
Lecture 6 Enumeration in java ADVANCE.pptx
Lecture 6 Enumeration in java ADVANCE.pptx
AbdulHaseeb956404
 
05a-enum.ppt
05a-enum.ppt
MuthuMs8
 
21CS642 Module 1 Enumerations PPT.pptx VI SEM CSE 2021 Batch Students
21CS642 Module 1 Enumerations PPT.pptx VI SEM CSE 2021 Batch Students
VENKATESHBHAT25
 
Effective Java - Enum and Annotations
Effective Java - Enum and Annotations
Roshan Deniyage
 
Enum - Coding Guidelines
Enum - Coding Guidelines
kleinron
 
Java essence part 1
Java essence part 1
HanRu Yeh
 
Enumerated data types
Enumerated data types
Ankit Sinha
 
C programming enumeration
C programming enumeration
Kaushal Kumar
 
Diving in OOP (Day 6): Understanding Enums in C# (A Practical Approach)
Diving in OOP (Day 6): Understanding Enums in C# (A Practical Approach)
Akhil Mittal
 
ENUM - make u r names as data types
ENUM - make u r names as data types
Ajay Chimmani
 
Evolution and Examples of Java Features, from Java 1.7 to Java 22
Evolution and Examples of Java Features, from Java 1.7 to Java 22
Yann-Gaël Guéhéneuc
 
Enumerations in java.pptx
Enumerations in java.pptx
Srizan Pokrel
 
Tiger: Java 5 Evolutions
Tiger: Java 5 Evolutions
Marco Bresciani
 
Ad

More from Edureka! (20)

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
Edureka!
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
Edureka!
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
Introduction to DevOps | Edureka
Introduction to DevOps | Edureka
Edureka!
 
What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
Edureka!
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
Edureka!
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
Introduction to DevOps | Edureka
Introduction to DevOps | Edureka
Edureka!
 
Ad

Recently uploaded (20)

PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
 
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
The Growing Value and Application of FME & GenAI
The Growing Value and Application of FME & GenAI
Safe Software
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
"Scaling in space and time with Temporal", Andriy Lupa.pdf
"Scaling in space and time with Temporal", Andriy Lupa.pdf
Fwdays
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
Daily Lesson Log MATATAG ICT TEchnology 8
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
2025_06_18 - OpenMetadata Community Meeting.pdf
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
All Things Open
 
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
Mastering AI Workflows with FME by Mark Döring
Mastering AI Workflows with FME by Mark Döring
Safe Software
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
 
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
The Growing Value and Application of FME & GenAI
The Growing Value and Application of FME & GenAI
Safe Software
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
"Scaling in space and time with Temporal", Andriy Lupa.pdf
"Scaling in space and time with Temporal", Andriy Lupa.pdf
Fwdays
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
Daily Lesson Log MATATAG ICT TEchnology 8
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
2025_06_18 - OpenMetadata Community Meeting.pdf
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
All Things Open
 
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
Mastering AI Workflows with FME by Mark Döring
Mastering AI Workflows with FME by Mark Döring
Safe Software
 

Enumeration in Java Explained | Java Tutorial | Edureka

  • 1. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
  • 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.
  • 5. WHY DO WE NEED ENUMERATION? www.edureka.co
  • 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
  • 14. DIFFERENCES BETWEEN CLASS AND ENUM www.edureka.co
  • 15. DIFFERENCES BETWEEN CLASS AND ENUM Class Constants can be overridden Enum constants cannot be overridden www.edureka.co
  • 16. Classes support the creation of Objects Enum cannot support the creation of objects DIFFERENCES BETWEEN CLASS AND ENUM www.edureka.co
  • 17. Classes can extend other classes Enum cannot extend other classes DIFFERENCES BETWEEN CLASS AND ENUM www.edureka.co
  • 18. Classes can implement Interface Enum can implement Interface DIFFERENCES BETWEEN CLASS AND ENUM www.edureka.co
  • 19. SYNTAX FOR ENUM IN JAVA www.edureka.co enum syntax: enum edureka{constants}
  • 20. PRACTICAL EXAMPLES OF ENUM www.edureka.co
  • 21. Copyright © 2017, edureka and/or its affiliates. All rights reserved. www.edureka.co
  • 22. Copyright © 2017, edureka and/or its affiliates. All rights reserved. www.edureka.co DEFINING ENUM www.edureka.co
  • 23. Copyright © 2017, edureka and/or its affiliates. All rights reserved. www.edureka.co ENUM SWITCH CASE www.edureka.co
  • 24. Copyright © 2017, edureka and/or its affiliates. All rights reserved. www.edureka.co INHERITANCE IN ENUM www.edureka.co
  • 25. Copyright © 2017, edureka and/or its affiliates. All rights reserved. www.edureka.co ENUM WITH CUSTOMIZED VALUES www.edureka.co
  • 26. Copyright © 2017, edureka and/or its affiliates. All rights reserved. www.edureka.co ENUM WITH IF-ELSE www.edureka.co
  • 27. Copyright © 2017, edureka and/or its affiliates. All rights reserved. www.edureka.co ENUM METHODS 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
  • 30. ENUM USECASE: ROCK PAPER SISSORS GAME www.edureka.co
  • 31. Copyright © 2017, edureka and/or its affiliates. All rights reserved. www.edureka.co