इस आर्टिकल में हम what is conditional statements in hindi ? और types of conditional statements in hindi के बारे में जानेंगे. दोस्तों hindi me iT me आपका बहुत बहुत अभिनान्दन हैं.
what is conditional statements in hindi | कंडीशनल स्टेटमेंट क्या है हिंदी में
java programming language में conditional statement बो होती हैं. जिसमें program की statement की condition को check किया जाता हैं. जो की condition true या false हो सकती हैं. यानी की ये statement कंडीशनल based होते हैं.
अगर condition true होती हैं तो वह statement execute होती हैं. और false होने पर execute नहीं होती हैं.
types of conditional statement in hindi | कंडीशनल स्टेटमेंट के प्रकार हिंदी में
java programming language में statement bassically चार प्रकार के होते हैं.
- if statement
- if-else statement
- if-else if statement
- switch case statement
what is if statement in hindi | if statement क्या है?
if statement में किसी भी java program की statement को test किया जाता हैं. if तब execute होगी जव कंडीशन true हो. ये कंडीशन program के एक बार execute होती हैं.
syntax:-
if(condition) { //statements come }
example:-
class Demo { public static void main(String args[]) { int i = 10; if (i < 15){ System.out.println("10 is less than 15"); } } }
output:-
10 is less than 15
what is if-else statement in hindi | if-else statement क्या है?
if-else statement में basically दो statement होती हैं if और else if statement execute तब होती हैं जब कंडीशन true हो अगर कंडीशन false हैं तो else statement execute होती हैं.
syntax-
if(condition) { //statement code } else { //statement code }
example 1 :- अगर if कंडीशन true हो तो.
class IfElse { public static void main(String args[]) { int i = 20; if (i < 15) { System.out.println("i is smaller than 15"); } else { System.out.println("i is greater than 15"); } } }
Output:-
i is greater than 15
example 2:- अगर कंडीशन false हो तो.
class IfElseDemo { public static void main(String args[]) { String str = "HindimeiT"; if (str == "hindi") { System.out.println("Hello HindimeiT"); } else { System.out.println("Welcome to HindimeiT"); } } }
Output:-
Welcome to HindimeiT
what is if-else if statement in hindi | if-else statement क्या है?
if-else if statement में multiple statement को check किया जाता हैं. इसमें if-else if statement में statement को उपर से नीचे की तरफ check किया जाता हैं. statement true हो जाती हैं वही execute हो जाती हैं. नही तो else वाली statement execute हो जताई हैं.
syntax-
if (condition) { //if statement 1; } else if (condition) { // else if statement 2; } . . else { // else statement; }
example 1:- अगर if कंडीशन true हो तो.
class Hindimeit { public static void main(String[] args) { int i = 20; // condition 1 if (i == 10) System.out.println("i is 10\n"); // condition 2 else if (i == 15) System.out.println("i is 15\n"); // condition 3 else if (i == 20) System.out.println("i is 20\n"); else System.out.println("i is not present\n"); } }
Output:-
i is 20
what is switch statement in hindi | switch statement क्या है?
switch statement भी if-else if के जैसे काम करता हैं . इसमें multiple statements होती हैं.
syntax-
switch (expression) { case value1: statement1; break; case value2: statement2; break; . . case valueN: statementN; break; default: statementDefault; }
example:-
class Switch { public static void main(String[] args) { int number = 20; // switch statement to check size switch (number) { case 21: System.out.println("21"); break; case 22: System.out.println("22"); break; case 20: System.out.println("20"); break; case 24: System.out.println("24"); break; default: size = "Unknown"; break; } } }
output:-
20
By reference :- https://www.javatpoint.com/control-flow-in-java
आशा करता हूँ what is conditional statements in hindi ? और types of conditional statements in hindi आपको पसंद आई होगी. अगर आपको इससे related कोई question पूछना हैं तो आप comment करके पूछ सकते है. अगर हमारे व्दारा की जानकर अच्छी लगी हो तो आपने दोस्तों के साथ जरुर शेयर करें. धन्यबाद
FAQ प्रश्न
प्रश्न – what is conditional statements in hindi ?
उत्तर – java programming language में conditional statement बो होती हैं. जिसमें program की statement की condition को check किया जाता हैं. जो की condition true या false हो सकती हैं. यानी की ये statement कंडीशनल based होते हैं.
अगर condition true होती हैं तो वह statement execute होती हैं. और false होने पर execute नहीं होती हैं.
प्रश्न – what is if statement in hindi?
उत्तर – if statement में किसी भी java program की statement को test किया जाता हैं. if तब execute होगी जव कंडीशन true हो. ये कंडीशन program के एक बार execute होती हैं.