java - How can I check if something has written in consol input? -
how can check if has written in console input? if isn't code go on if write new happens? possible?
scanner k2sk; k2sk = new scanner(system.in); k2sk.nextline();
but code waits until write something
if want wait user input, , @ same time don't wish wait it, assign duty thread
.
here have done short example, hope useful:
import java.util.scanner; public class testinput { public static void main(string[] aa) { new thread(new t1()).start(); system.out.println("moved further"); } public static class t1 implements runnable { public void run() { scanner k2sk; k2sk = new scanner(system.in); k2sk.nextline(); system.out.println("done"); } } }
Comments
Post a Comment