#12 If else in Java

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

Coupon: TELUSKO10 (10% Discount)

Udemy Courses:

For More Queries WhatsApp or Call on : +919008963671

In this lecture we are discussing:
1)What is conditional statements?
2)types of conditional statements
a) if-else
b) switch (next lecture)
c) ternary operator (next lecture)
d) nested if-else (next lecture)
e) if-else-if ladder (next lecture)

3)syntax of if-else
4)example on if-else condition

#1
-- conditional statement is a statement that can be true or false.
-- suppose if ask student is pass. (answer yes or no)
-- this type of statement of statement is conditional statement.

#2
In this part we are only discussing about if-else and
in next lecture we are discussing if-else-if ladder, ternary operator and switch statement.

#3
syntax of if-else

-- condition is either true or false after evaluation
-- remember like c and c++, we cannot use number directly as condition of if-else
-- if(5) --- not allowed in java
-- you get Type mismatch: cannot convert from int to boolean
if(condition)
{
//code
//either this part execute
}

else
{
//code
//or this part execute
}

#4
example:
if want to check a given number is even or odd then;
int num=13;
if(num%2==0)

else

Note: for single statement braces is not required but for multiple statement it is required.


More Learning :

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

I was thinking Java is difficult to learn. But you teach every concept friendly, like two friends are taking. Now I think Java is simple and fantastic programming language. Thank you 🙏 @navin reddy sir for teaching us java in simple way. My each concept of java is now clear.

ayodhyarode
Автор

"when you use else, there is a compulsion to use if." You have a very excellent way with words. It would be a crime if youre not a PHD. CS professor is one of your callings. Even the explanation of string immutability you have is excellent. Concise and also covering stack/heap memory. Perhaps the best explanations of java concepts on youtube.

flymykim
Автор

I am learning Java, i have tried many tutorials and these are the best ones. thanks

fezaiozcan
Автор

Its really good example you have explained very well. thanks for the video.

rwhbmoj
Автор

Best java course i could find for free thank u soooo much

yomnakamal
Автор

Sir thanku so much for this new playlist.. I learn lot from this new playlist.. sir one request to you that plz make one new playlist like this on spring boot from basic to advanced.plzz sir

debmalyamukherjee
Автор

your class is simply super but small request from my side explain syntax along with the example, it will be more useful.

Vijay-ztnx
Автор

how can i practice sir iam understood everything you tolled

venkycreations
Автор

Thank you soo much Sir 😍❤️
For your videos and Efforts Sir 😍🥺
Can you please make Advance Java (jee).

suryanaidu
Автор

Hi sir please make tutorial on Selenium with Java. For automation testing. Need your help

abhishekbasu
Автор

Notification: Marvel studios wants to know your location (5:55)

devanshusachdev
Автор

Do we not need curly brackets for if and else statements?

Caped_Crusader