Nested for Loops

For example, here is a program that nests for loops:

   
public class Main {
  public static void main(String args[]) {
    for (int i = 0; i < 10; i++) {
      for (int j = i; j < 10; j++)
        System.out.print(".");
      System.out.println();
    }
  }
}  

The output produced by this program is shown here:


.......... 
......... 
........ 
....... 
...... 
..... 
.... 
... 
.. 
.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.