Our social:

Wednesday, October 5, 2016

Nested Loops in Java-Tutorial

Nested loop is nothing but loop inside a loop. A very basic example for a nested loop is shown below.
public class NestedLoopDemo {

 public static void main(String[] args) {

  for(int i = 3; i>0;  i--)
  {
   for(int j = 0; j<2; j++)
   {
    System.out.println("i :: "+i+" j :: "+j);
   }
  }
 }
}
Try It
The output is :
i :: 3  j :: 0
i :: 3  j :: 1
i :: 2  j :: 0
i :: 2  j :: 1
i :: 1  j :: 0
i :: 1  j :: 1

       

   Break Statement in Java

0 comments:

Post a Comment

Hello Every One thanks For Visit My site You Can Suggest any Idea About site And Related Education Information Provide me Its Best Content For you am Include in this Site And feel free contact And email now I hope This site very help full you