Need Help for this Java Program

public class While
{
public static void main(String[]args)
{
int ilan;
int i=0;
system.out.printIn("How many times you want to display your name?");
ilan=textIO.getInInt();

While(i<ilan)
{
system.out.printIn("Dennis");
i++;
}
}
}



When i execute the program theres is 1 error i cant find...Need help..tnx

while.java:10: error: ';' expected
While(i<ilan)
^
1 error
Hi,
Java language is case-sensitive
Thus, "While" is totally different from "while". While "while" is a keyword "While" is just a custom name a programmer uses (to name a variable, etc)

So the answer is :
while(i<ilan)
Last edited on
Standard classes in Java start with an upper case letter so you need to spell "system" with an upper case S.
The method used for printing is called println with a lower case L, not an upper case I.
 
System.out.println("Dennis");
Last edited on
Thank you peter & 5a...i can't still run the program,still have error,


C:\Practice>javac While.java
While.java:8: error: cannot find symbol
ilan=textIO.getlnInt();
^
symbol: variable textIO
location: class While
1 error
Last edited on
Hi,

I think textIO is not the standard input/output stuff...
Here is your working code of what you are trying to do.

import java.io.*;
import java.util.*;

public class While{
public static void main(String[]args){
int ilan;
int i = 0;
String counter = "";
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.println("How many times you want to display your name?");

counter = reader.readLine();

} catch (IOException ioe) {
ioe.printStackTrace();
}
ilan = Integer.parseInt(counter);
//system.out.printIn("How many times you want to display your name?");
//ilan=textIO.getInInt();

while(i < ilan){
System.out.println("Dennis");
i++;
}
}
}
Topic archived. No new replies allowed.