Mastering Java and Spring Boot - Live Course : https://bit.ly/TeluskoJavaLive
For More Queries WhatsApp or Call on : +919008963671


In this lecture we will learn:
- Use of enum with if-else statements
- Use of enum with switch


- We can compare the status or values of an enum by using the if- else condition.
- Switch supports string, integer etc, and it also support enum.
- In switch() you need to pass an object reference variable as a parameter.
e.g.,
enum Status{
Running, Failed, Pending, Success;
}
if(s==Status.Running)
System.out.println("All Good");
else if(s==Status.Failed)
System.out.println("Try Again");
else if ( s==Status.Pending)
System.out.println("Please Wait");
else
System.out.println("Done");


- In switch case, we do not have to pass the object refernce variable again and again. We have to only pass the constant itself.
e.g.,
Status s=Status.Pending;
switch(s)
{
case Running:
System.out.println("All Good");
break;

case Failed:
System.out.println("Try Again");
break;

case Pending:
System.out.println("Please Wait");
break;

default:
System.out.println("Done");
break;
}

Github repo : https://github.com/navinreddy20/Javacode.git

Java:- https://bit.ly/JavaUdemyTelusko
Spring:- https://bit.ly/SpringUdemyTelusko

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