#13 If Else If in Java

preview_player
Показать описание
Check out our courses:

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO20 (20% Discount)

For More Queries WhatsApp or Call on : +919008963671

Udemy Courses:

In this lecture we are discussing:
1) what is if-else-if ladder?
2) syntax of if-else-if ladder
3) example of if-else-if

#1
-- if-else-if ladder is a series of if, else if or else statements that are executed based on the boolean condition.
-- if else if ladder is used to test multiple conditions

#2
syntax of if-else-if ladder

if(condition1)
{
//block of code
}
else if(condition2){
//block of code
}
else if(condition3)
{
//block of code
}
else{
//block of code
}

Note: only one block is executed from all. If all condition is false then else part executed

#3
-- check greatest number from three number.
int x=8;
int y=7;
int z=6;
if(x y && x z)
else if(y z)
else


More Learning :

Donation:
PayPal Id : navinreddy20
Рекомендации по теме
Комментарии
Автор

Checking if the values are equal will make the program a bit faster. If you use if (x >= y && x >= z) and all three values are the same it will return x immediately instead of going to the else-if and then finally returning the z value from the last line which obviously is the same as x since x = y = z.

actandrepeat
Автор

Sir really has the ability to explain well ❤, Love the course so far, switching from JavaScript to Java, Very understandable, also i'd love if sir made some community for our questions ❤❤❤

ArcturusWasTaken
Автор

U can also apply this approarc➡️
Declare max = x
If (y>max)
y=max
If(z>max)
z=max

frstmani
Автор

hi sir. instead of using "double and method" i used if else method and and not used any "else if" . is it ok to follow this method or the method you used is more efficient in terms of time complexity and test cases? kindly reply sir. this is for interview purposes.

karthickm
Автор

Guys really awasome video, For the best video you can go to Ratan java or Navin Java are Best in youtube world you Navin for wonderful video.

prabinkumar
Автор

Hello sir, i would kindly request if you include assignments as we proceed with the tutorials. Thank You.

Trunk_Tech
Автор

Any reason for making these my videos sir

TechNcookBook