jpnv8
03-29-2008, 03:41 AM
import java.io.*;
public class DoWhile
{
public static InputStreamReader reader= new InputStreamReader (System.in);
public static BufferedReader input= new BufferedReader (reader);
public static void main (String [] args)
throws Exception
{
int x=0; //when do we need to initialize a variable
//DO-WHILE STATEMENT
do{
x++;
System.out.println(x);
} while(x<3);
A.)
int x=0; //when do we need to initialize a variable
-When do we need to initialize a variable? Sometimes int x,y; works without assigning a value to it. thx
public class DoWhile
{
public static InputStreamReader reader= new InputStreamReader (System.in);
public static BufferedReader input= new BufferedReader (reader);
public static void main (String [] args)
throws Exception
{
int x=0; //when do we need to initialize a variable
//DO-WHILE STATEMENT
do{
x++;
System.out.println(x);
} while(x<3);
A.)
int x=0; //when do we need to initialize a variable
-When do we need to initialize a variable? Sometimes int x,y; works without assigning a value to it. thx