Java examples for Language Basics:for
Scoping out the counter variable in for loop
public class Main{ public static void main(String[] args){ int i;/* ww w . j a v a2s .c o m*/ for (i = 1; i <=10; i++) System.out.println(i); System.out.println("The final value of i is " + i); } }