Breaking

Search This Blog

Saturday, 8 September 2018

For Loops in java [hindi and english both]


For Loops in java [hindi and english both]

Repeat repeating the same statement is 'looping'. In Java, three types of loops work.
वही एक कथन दोहराएं दोहराएं 'लूपिंग' है। जावा में, तीन प्रकार के लूप काम करते हैं।
  • .    for Loop
  • .     while Loop
  • .    do_while Loop

1. for Loop
Core Java has two types for for loop.
कोर जावा के लिए लूप के लिए दो प्रकार हैं।
1.   "Normal for Loop".
2.   "Enhanced or foreach Loop".


1.1 Normal for Loop
The statement repeats until the condition given for for the loop.
लूप के लिए दी गई स्थिति तक बयान दोहराया जाता है।


Syntax for for Loop
for( initialization; condition; increment/decrement ){
       
        //statements;
Example for for Loop
Source Code :
public class_ForLoop
{

    public static void main(String args[])
{
       
        for( int i=0; i < 10; i++ )
{
              System.out.println("Value of i is " + i);
}
}
}



Output :

Value of i is 0
Value of i is 1
Value of i is 2
Value of i is 3
Value of i is 4
Value of i is 5
Value of i is 6
Value of i is 7
Value of i is 8
Value of i is 9
1.2 Enhanced or foreach Loop
Foreach is used to print the value of the elements in an array, but it is better than for the loop in case of array.
Foreach का प्रयोग किसी सरणी में तत्वों के मान को मुद्रित करने के लिए किया जाता है, लेकिन सरणी के मामले में लूप के लिए यह बेहतर है।
for(variable_name : array_name){
       
        //statement(s);

}


Example for foreach Loop
Source Code :

public class ForandForeachLoop{

    public static void main(String args[]){
       
        int[] arr = {10, 15, 20, 25, 30};
       
               System.out.println("Using for Loop");
        for( int i=0; i<arr.length; i++ ){
               System.out.println("Value of arr is " + arr[i]);
        }
       
               System.out.println("\nUsing foreach Loop");
        for(int a : arr){
               System.out.println("Value of arr is " + a);
        }
       
        }
}
Output :

Using for Loop
Value of arr is 10
Value of arr is 15
Value of arr is 20
Value of arr is 25
Value of arr is 30

Using foreach Loop
Value of arr is 10
Value of arr is 15
Value of arr is 20
Value of arr is 25
Value of arr is 30


WHILE OR DO WHILE FOOPS ARE STUDY IN NEXT Post

loop kya hai in hindi,types of loop in foxpro,conditional statement in hindi,loop in c language notes,what is loop in javascript in hindi,java full notes in hindi,For Loops in java [hindi and english both],for loop in java in hindi,for each loop in java in hindi,while loop in java in hindi,nested loop in hindi,loop kya hai in hindi,types of loop in foxpro,conditional statement in hindi,loop in c language notes,what is loop in javascript in hindi,java full notes in hindi,For Loops in java [hindi and english both],for loop in java in hindi,for each loop in java in hindi,while loop in java in hindi,nested loop in hindi,loop kya hai in hindi,types of loop in foxpro,conditional statement in hindi,loop in c language notes,what is loop in javascript in hindi,java full notes in hindi,For Loops in java [hindi and english both],for loop in java in hindi,for each loop in java in hindi,while loop in java in hindi,nested loop in hindi,loop kya hai in hindi,types of loop in foxpro,conditional statement in hindi,loop in c language notes,what is loop in javascript in hindi,java full notes in hindi,For Loops in java [hindi and english both],for loop in java in hindi,for each loop in java in hindi,while loop in java in hindi,nested loop in hindi,loop kya hai in hindi,types of loop in foxpro,conditional statement in hindi,loop in c language notes,what is loop in javascript in hindi,java full notes in hindi,For Loops in java [hindi and english both],for loop in java in hindi,for each loop in java in hindi,while loop in java in hindi,nested loop in hindi,loop kya hai in hindi,types of loop in foxpro,conditional statement in hindi,loop in c language notes,what is loop in javascript in hindi,java full notes in hindi,For Loops in java [hindi and english both],for loop in java in hindi,for each loop in java in hindi,while loop in java in hindi,nested loop in hindi,loop kya hai in hindi,types of loop in foxpro,conditional statement in hindi,loop in c language notes,what is loop in javascript in hindi,java full notes in hindi,For Loops in java [hindi and english both],for loop in java in hindi,for each loop in java in hindi,while loop in java in hindi,nested loop in hindi,loop kya hai in hindi,types of loop in foxpro,conditional statement in hindi,loop in c language notes,what is loop in javascript in hindi,java full notes in hindi,For Loops in java [hindi and english both],for loop in java in hindi,for each loop in java in hindi,while loop in java in hindi,nested loop in hindi,loop kya hai in hindi,types of loop in foxpro,conditional statement in hindi,loop in c language notes,what is loop in javascript in hindi,java full notes in hindi,For Loops in java [hindi and english both],for loop in java in hindi,for each loop in java in hindi,while loop in java in hindi,nested loop in hindi

No comments:

Post a Comment

'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();