Declare multiple variables in for loop - Java Language Basics

Java examples for Language Basics:for

Description

Declare multiple variables in for loop

Demo Code


public class Main {
 
  public static void main(String[] args) {
     for(int i=0, j=1, k=2 ; i<5 ; i++)
       System.out.println("I : " + i + ",j : "+ j + ", k : " + k);
  }//from w w w  .  ja  v a  2  s  .  co  m
}

Result


Related Tutorials