filmov
tv
#12 If else in Java
![preview_player](https://i.ytimg.com/vi/74Q7POjS7mQ/maxresdefault.jpg)
Показать описание
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
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
Комментарии