Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Thursday, August 2, 2012

CJ-12: Print a message 5 times-For loop

Type the programs in NOTEPAD or DOS prompt itself, for Consol Application.
Type in NETBEANS or ECLIPSE for Window Application.
Here after , I am just typing the programs only..to know more about it , refer

Introduction to JAVA 

before doing any JAVA Programs.
***********************************************************************************************
import java.io.*;
class loop3
{
public static void main(String args[])
{
     int i;
     for(i=0;i<=4;i++)
     {
System.out.println("Welcome to JAVA");
     }
}
}
=========================================================================
Output :
Welcome to JAVA
Welcome to JAVA
Welcome to JAVA
Welcome to JAVA




CJ-11: Print a message 5 times-Do While loop

Type the programs in NOTEPAD or DOS prompt itself, for Consol Application.
Type in NETBEANS or ECLIPSE for Window Application.
Here after , I am just typing the programs only..to know more about it , refer

Introduction to JAVA 

before doing any JAVA Programs.
***********************************************************************************************
import java.io.*;
class loop2
{
  public static void main(String args[])
{
     int i=0;
     do
     {
System.out.println("Welcome to JAVA");
i++;
     }
while(i<=4);
}
}
=========================================================================
Output :
Welcome to JAVA
Welcome to JAVA
Welcome to JAVA
Welcome to JAVA