Java examples for Language Basics:for
Nesting Your for Loops with another for loop
public class NestedLoop { public static void main(String[] args) {//from w ww . j a v a 2s . co m for(int x = 1; x < 10; x++) { for (int y = 1; y < 10; y++) System.out.print(x + "-" + y + " "); System.out.println(); } } }