Skip to main content

stay open code

1 reply [Last post]
robadob
Offline
Joined: 2008-01-18
Points: 0

ive started coding java since about christmas, i can run java programs i have made in cmd (im still on basic command stuff) java Hello 0 )
{
System.out.println("Nuke in " + num ) ;
num -= 1 ;
}
}
}
[/code]

could you edit it into that ' while' countdown script for me please so i know where it goes

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
aberrant
Offline
Joined: 2006-02-02
Points: 0

Well code would require the program not exit. If thats really what you want you could read one character from System.in. That would make it look like it "pauses" until you hit a button.

[code]
// code that does something
try
{
System.out.println("Press Enter to Continue...");
System.in.read();
}
catch (IOException e)
{
e.printStackTrace();
}
[/code]

I would just either use an IDE like Eclipse (eclipse.org) or Netbeans (netbeans.org) they have console windows that preserver the output from your program.