
#12 If else in Java
Check out our courses:
AI Powered DevOps with AWS - Live Course :- go.telusko.com/AIDevOps-AWS
Coupon: TELUSKO10 (10% Discount)
Complete Java Developer Course Batch-4: go.telusko.com/Complete4
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : go.telusko.com/masterjava
Coupon: TELUSKO20 (20% Discount)
For More Queries WhatsApp or Call on : +919008963671
Udemy Courses:
Spring: go.telusko.com/udemyteluskospring
Java:- go.telusko.com/udemyteluskojava
Java Spring:- go.telusko.com/Udemyjavaspring
Java For Programmers:- go.telusko.com/javaProgrammers
Python : go.telusko.com/udemyteluskopython
Git : go.telusko.com/udemyteluskogit
Docker : go.telusko.com/udemyteluskodocker
website : courses.telusko.com/
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)
System.out.println("Even"); //here we not use braces for single statement {}
else
System.out.println("Odd"); // here we not use braces {}
Note: for single statement braces is not required but for multiple statement it is required.
Github repo : github.com/navinreddy20/Javacode.git
Java:- bit.ly/JavaUdemyTelusko
Spring:- bit.ly/SpringUdemyTelusko
More Learning :
Java :- bit.ly/3x6rr0N
Python :- bit.ly/3GRc7JX
Django :- bit.ly/3MmoJK6
JavaScript :- bit.ly/3tiAlHo
Node JS :- bit.ly/3GT4liq
Rest Api :-bit.ly/3MjhZwt
Servlet :- bit.ly/3Q7eA7k
Spring Framework :- bit.ly/3xi7buh
Design Patterns in Java :- bit.ly/3MocXiq
Docker :- bit.ly/3xjWzLA
Blockchain Tutorial :- bit.ly/3NSbOkc
Corda Tutorial:- bit.ly/3thbUKa
Hyperledger Fabric :- bit.ly/38RZCRB
NoSQL Tutorial :- bit.ly/3aJpRuc
Mysql Tutorial :- bit.ly/3thpr4L
Data Structures using Java :- bit.ly/3MuJa7S
Git Tutorial :- bit.ly/3NXyCPu
Donation:
PayPal Id : navinreddy20
www.telusko.com/
コメント