Conditional statements in java | if else | switch statements | else if | Simple If | Java Tutorial

Publicado el: 01 January 1970
en el canal de: Parnika Tutorials
420
15

"Conditional statements in java || if else || switch statements || else if || Simple If || Java Tutorial for Beginners | Learn Java | Parnika Tutorials

#conditionalstatemnts #elseif #ifelse #switchstatements #simpleif #javastatements #javafeatures #featuresjava #java #javafullcourse #javatutorials #javaforbeginners #javalanguage #learnjava #javacompletecourse #javaprogramming #javatutorialforbeginners #parnikatutorials #javacourse

00:00 - Introduction
00:28- Simple if
10:38 - Implementation of simple if
15:26 - If else in java
22:15 - Checking given number is even or odd
26:09 - Else if ladder in java
35:19 - Verifying given number is positive or negative
38:06 - Switch statement in java
47:14 - Implementation of switch statement

previous video- #10 INPUT AND OUTPUT STREAMS IN JAVA | INPUT AND OUTPUT IN JAVA | JAVA FULL COURSE
   • Java - Input & Output Streams | Input...  "

Social media Links:
Instagram:   / parnikatutorials  
Website: http://parnikatutorials.in/
Email id: [email protected]
To get the regular updates:
Telegram link: https://t.me/Parnikatutorials
Facebook: https://m.facebook.com/profile.php?id...
Linkedin:   / parnika-tutorials-a8a9831b2  
Pinterest:   / parnikatutorials0892  

Playlists:
Virtual Coffee with Jagadeesh:    • VIRTUAL COFFEE WITH JAGADEESH  
Digital Logic:    • ABOUT PARNIKA TUTORIALS  
Computer Organization and Architecture:    • ABOUT PARNIKA TUTORIALS  
C Programming:    • L 1: WHAT IS AN ALGORITHM AND CHARACT...  
Data Structures:    • L 1: Uncover the Benefits of Linked L...  
Theory of Computation:    • ABOUT PARNIKA TUTORIALS  
Compiler Design:    • ABOUT PARNIKA TUTORIALS  
Operating Systems:    • PROCESS STATE DIAGRAM | LONG TERM, SH...  
Databases:    • ABOUT PARNIKA TUTORIALS  
Computer Networks:    • ABOUT PARNIKA TUTORIALS  
For GATE PYQs and much more explore:    / parnikatutorials  

if statement is the most simple decision-making statement. It is used to decide whether a certain statement or block of statements will be executed or not i.e if a certain condition is true then a block of statement is executed otherwise not
The if statement executes a certain section of code if the test expression is evaluated to true. However, if the test expression is evaluated to false, it does nothing.

In this case, we can use an optional else block. Statements inside the body of else block are executed if the test expression is evaluated to false. This is known as the if-...else statement in Java.

The syntax of the if...else statement is:

if (condition) {
// codes in if block
}
else {
// codes in else block
}
In Java, we have an if...else...if ladder, that can be used to execute one block of code among multiple other blocks.

if (condition1) {
// codes
}
else if(condition2) {
// codes
}
else if (condition3) {
// codes
}
.
.
else {
// codes
}
Here, if statements are executed from the top towards the bottom. When the test condition is true, codes inside the body of that if block is executed. And, program control jumps outside the if...else...if ladder.

If all test expressions are false, codes inside the body of else are executed.
The switch statement allows us to execute a block of code among many alternatives.

The syntax of the switch statement in Java is:

switch (expression) {

case value1:
// code
break;

case value2:
// code
break;

...
...

default:
// default statements
}

How does the switch-case statement work?

The expression is evaluated once and compared with the values of each case.

If expression matches with value1, the code of case value1 are executed. Similarly, the code of case value2 is executed if expression matches with value2.
If there is no match, the code of the default case is executed.


En esta página del sitio puede ver el video en línea Conditional statements in java | if else | switch statements | else if | Simple If | Java Tutorial de Duración hora minuto segunda en buena calidad , que subió el usuario Parnika Tutorials 01 January 1970, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 420 veces y le gustó 15 a los espectadores. Disfruta viendo!