for loop

Syntax:
 for(initialisation; condition; updating)
 {
  statements;
 }

Execution flow of a for loop is given bellow.
step 1 : Perform the initialisation
step 2 : Check the condition, if condition is false then exit the loop, otherwise continue
step 3 : Execute the loop body
step 4 : Perform the updating and go to step 2.

You can see that the initialization perform only once for the loop. The loop cycles through the condition, loop body and the updation till the condition become  a false one. Condition is always a boolean one. The loop componenets are seperates by semicoloun (;) not by commas (,)
Example:
 for (int i = 0; i< 5; i++)
 {
 System.out.println(" Greetings from easy way 2 in ");
 }

It is possible to use multiple initialization and updation in a for loop, but seperates them with
 commas. If multiple condition is used then connects them with any of the logical operators (AND, OR, NOT....)The following is also a valid for loop
 for(int i=1,j=0; i<=5; i++,j++)
 {
                  System.out.println(i);
                  System.out.println(j);
 }

Example : Finding the factorial of a number.
import java.io.*;
public class FactorialDemo
{
public static void main(String args[]) throws IOException
{
int fact, num;
fact = 1;
num = 1;

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter a number :");
num = Integer.parseInt(br.readLine());
for(int i=1; i<=num; i++)
{
fact = fact * i ;
}
System.out.println("Factorial of  "+num+"=  " +fact);

}
}

Output: