#70 Enum Class in Java
119.8K views on YouTube
Check out our courses:
Mastering Agentic AI with Java : https://go.telusko.com/agentic-ai
Coupon: TELUSKO10 (10% Discount)
DevOps Bootcamp: https://go.telusko.com/complete-devops
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : https://go.telusko.com/learn-master
Coupon: TELUSKO10 (10% Discount)
For More Queries WhatsApp or Call on : +919008963671
website : https://telusko.com/
Udemy Courses:
Java Spring:- https://go.telusko.com/Udemyjavaspring
Java:- https://go.telusko.com/udemyteluskojava
Spring: https://go.telusko.com/udemyteluskospring
Java For Programmers:- https://go.telusko.com/javaProgrammers
Python : https://go.telusko.com/udemyteluskopython
Git : https://go.telusko.com/udemyteluskogit
Docker : https://go.telusko.com/udemyteluskodocker
Instagram : https://www.instagram.com/navinreddyofficial/
Linkedin : https://in.linkedin.com/in/navinreddy20
WhatsApp : https://go.telusko.com/whatsapp
TELUSKO Android App : https://go.telusko.com/TELUSKOAPP
TELUSKO IOS App : https://apple.co/3SsgmU2
Discord : https://discord.gg/D8hWe9BqfF
In this lecture we will learn:
– Inheritance with the enum
– Super class of enum
– Enum and Constructor
– Object creation in an enum
– Important points used in the enum
#1
– We can not extend the enum with any other class.
– We can define constructors and methods in an enum. Creation of our constructors and variables is also possible in an enum.
– We can also define our data types through enum that are known as Enumerated Data Types.
– In Java, enum extends the enum class and we get all other methods present inside an enum through the enum class only.
– If we print the superclass of an enum class, then it will also return an enum.
Status s= Status.Success;
System.out.println(s.getClass().getSuperclass());
– In an enum, every enum constant represents an object of type enum.
#2
Enum and Constructor:
– enum contains a constructor and it is executed separately for each enum constant at the time of enum class loading.
– We can create a constructor in an enum that can take any parameter, and that value of a parameter might be different in every object of an enum.
– Instance variables in an enum are private and we can access them in another class by using getters and setters.
– We can print the value of all objects of an enum through a loop and .values() method is used to iterating over all objects.
– If any parameterized constructor is present inside an enum, then the default constructor will not be considered.
– We create private variables and private constructors in an enum because we use them or create an object for constructors in the same class only.
– The constructor in an enum will be called the number of times as much the number of objects created.
Github repo : https://github.com/navinreddy20/Javacode.git
More Learning :
Java :- https://bit.ly/3x6rr0N
Python :- https://bit.ly/3GRc7JX
Django :- https://bit.ly/3MmoJK6
JavaScript :- https://bit.ly/3tiAlHo
Node JS :- https://bit.ly/3GT4liq
Rest Api :-https://bit.ly/3MjhZwt
Servlet :- https://bit.ly/3Q7eA7k
Spring Framework :- https://bit.ly/3xi7buh
Design Patterns in Java :- https://bit.ly/3MocXiq
Docker :- https://bit.ly/3xjWzLA
Blockchain Tutorial :- https://bit.ly/3NSbOkc
Corda Tutorial:- https://bit.ly/3thbUKa
Hyperledger Fabric :- https://bit.ly/38RZCRB
NoSQL Tutorial :- https://bit.ly/3aJpRuc
Mysql Tutorial :- https://bit.ly/3thpr4L
Data Structures using Java :- https://bit.ly/3MuJa7S
Git Tutorial :- https://bit.ly/3NXyCPu
Donation:
PayPal Id : navinreddy20
https://www.telusko.com