Java application help?????????????

S

S. Gregory

How do you create a pause in a Java application that requires you to
press a key to continue until the conditional statement is complete?
The folowing is what I have so far..

class Count{
public static void main(String[] arguments) throws Exception {

int a = 100;
int b = 20;
int x;


for (x = 0;x < a;x++) {


System.out.println((x+1) + "." + "Message goes here to be displayed
100 times.");

}

I would like the application to display 1 - 20 then pause and display
20 more and 20 more and so on. I tried to use System.in.read();, but
it only displayed two at a time. Please Help.
 
K

Karthik

S. Gregory said:
How do you create a pause in a Java application that requires you to
press a key to continue until the conditional statement is complete?
The folowing is what I have so far..

class Count{
public static void main(String[] arguments) throws Exception {

int a = 100;
int b = 20;
int x;


for (x = 0;x < a;x++) {
if ( a % 20 == 0) {
System.in.read();
}
Every 20 times this one pauses for you .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top