इस आर्टिकल में हम what is loops statement in java in hindi | जावा में लूप स्टेटमेंट क्या हैं हिंदी में और types of loops in java in Hindi | जावा में लूप के प्रकार हिंदी में के बारे में जानेंगे. दोस्तों hindi me iT me आपका बहुत बहुत अभिनान्दन हैं.
what is loops statement in java in hindi | जावा में लूप स्टेटमेंट क्या हैं हिंदी में
loops statement के द्वारा किसी भी एक statement एक से अधिक statement को एक से अधिक बार execute करा सकते हैं. loops statement में सबसे पहले कंडीशन check करता हैं. अगर कंडीशन true होती हैं तो वह statement तब तक execute होती रहेगी जब तक कंडीशन false नहीं हो जाती हैं.
types of loops in java in Hindi | जावा में लूप के प्रकार हिंदी में
java programming language में loops तीन types के होते हैं.
- while loop
- do-while loop
- for loop
- For-each loop
what is while loop in java in hindi | जावा में while loop क्या है हिंदी में
while loop में सबसे पहले कंडीशन को check किया जाता हैं. अगर कंडीशन true होती हैं तो वह statement तब तक execute की जाती हैं जब तक कंडीशन false नहीं हो जाती हैं .
syntax:-
while (test_expression) { // statements update_expression; }
example:-
class whileLoop { public static void main(String args[]) { // initialization expression int i = 1; // test expression while (i < 6) { System.out.println("Hindi me iT"); // update expression i++; } } }
output:-
Hindi me iT Hindi me iT Hindi me iT Hindi me iT Hindi me iT
what is do-while loop in java in hindi | जावा में do-while loop क्या है हिंदी में
do-while loop execute होने का तरीका while जैसा ही हैं. इसमें अंतर इतना हैं. की do-while loop में एक बार statement execute हो जाती हैं. उसके बाद कंडीशन को check किया जाता हैं. जबकि while loop में पहले कंडीशन को check किया जाता हैं उसके बाद statement execute होती हैं.
यानी की do-while loop एक बार तो statement को execute करेगा ही चाहे कंडीशन false क्यों न हो.
syntax:-
do { // do-while Loop Body Update_expression } // Condition check while (test_expression);
class DoWhileLoop { // Main driver method public static void main(String[] args) { // initial counter variable int i = 0; do { System.out.println("Print statement"); i++; } // Checking condition // Note: It is being checked after // minimum 1 iteration while (i < 0); } }
output:-
Print statement
class DoWhileLoop { // Main driver method public static void main(String args[]) { // Declaring and initialization expression int i = 1; // Do-while loop do { System.out.println("HindimeIt"); // Update expression i++; } // Test expression while (i < 6); } }
output:-
HindimeiT HindimeiT HindimeiT HindimeiT HindimeiT
what is for loop in java in hindi ? | जावा में for loop क्या हैं ?
java programming language में for loop while loop के जैसे ही काम करता हैं. java programming language में for loop एक entry controlled होता हैं. जब तक entry controlled कंडीशन true होती हैं उस कंडीशन का तब तक execution होता रहेगा जब तक कंडीशन false नहीं हो जाती हैं.
for loop का syntax तीन भाग में divide होता हैं.
- variable initialization
- condition
- increment/decrement
syntax:-
for(initialization; condition; increment/decrement){ //statement or code to be executed }
example 1:-
class ForLoop { public static void main(String[] args) { for (int i = 1; i <= 10; i++) { System.out.println(i); } } }
output :-
1 2 3 4 5 6 7 8 9 10
example 2:-
class forLoop { public static void main(String args[]) { // Writing a for loop // to print Hello World 5 times for (int i = 1; i <= 5; i++) { System.out.println("Hindi me iT");
} } }
output:-
Hindi me iT Hindi me iT Hindi me iT Hindi me iT Hindi me iT
what is for-each loop in java in hindi? | java में for-each loop क्या होता हैं ?
for each loop वैसे ही काम करता हैं जैसे अन्य loop कम करते हैं.
इसका use basically array को traverse करने या एट्रेट करने के लिए किया जाता हैं.
syntax:-
for (type var : array) { statements using var; }
example:-
class For_Each { public static int maximum(int[] numbers) { int maxSoFar = numbers[0]; // for each loop for (int num : numbers) { if (num > maxSoFar) { maxSoFar = num; } } return maxSoFar; }
public static void main(String[] arg) { { int[] marks = { 125, 132, 95, 116, 110 }; int highest_marks = maximum(marks); System.out.println("The highest score is " + highest_marks); } } }
Output:-
The highest score is 132
what is jump statement in java in hindi? | java में jump statement क्या है?
किसी भी loop control करने के लिए java में दो और control statement होती हैं.
types of jump statement in java in hindi.
- continue statement
- Break statement
what is continue statement in java in hindi ?| जावा में continue statement क्या है हिंदी में?
continue statement उपयोग तब किया जाता हैं जब किसी specific कंडीशन के true होने पर वह statement execute नहीं होती हैं और loop उस statement को skip करके चलता रहता हैं.
Example 1:-
// Java Program to illustrate the use of continue statement // Importing Classes/Files public class ContinueStatement { // Main driver method public static void main(String args[]) { // For loop for iteration for (int i = 0; i <= 15; i++) { // Check condition for continue if (i == 10 || i == 12) { // Using continue statement to skip the // execution of loop when i==8 or i==14 continue; } // Printing elements to show continue statement System.out.print(i + " "); } } }
Output:-
0 1 2 3 4 5 6 7 9 10 11 12 13 15
इस example में 8 और 14 print नहीं हुआ हैं.
what is Break statement in java in hindi? | जावा में Break statement क्या है हिंदी में ?
Break statement में एक specific कंडीशन के true होने पर loop को exit या terminate करा देते हैं.
example:-
class BreakLoop { public static void main(String args[]) { // Initially loop is set to run from 0-9 for (int i = 0; i < 10; i++) { // terminate loop when i is 5. if (i == 5) break; System.out.println("i: " + i); } System.out.println("Loop complete."); } }
output:-
i: 0 i: 1 i: 2 i: 3 i: 4 Loop complete.
By reference :- https://www.javatpoint.com/control-flow-in-java
आशा करता हूँ what is loops statement in java in hindi | जावा में लूप स्टेटमेंट क्या हैं हिंदी में और types of loops in java in Hindi आपको पसंद आई होगी. अगर आपको इससे related कोई question पूछना हैं तो आप comment करके पूछ सकते है. अगर हमारे व्दारा की जानकर अच्छी लगी हो तो आपने दोस्तों के साथ जरुर शेयर करें. धन्यबाद