How can I stop input using ctrl+d in java and eclipse? -


i stop scanner when pressing ctrl d. possible?

import java.util.scanner; public class inputtest  {     public static void main(string args[])     {         scanner input = new scanner(system.in);         system.out.print("enter string: ");         string string = input.next();         system.out.println(string);          /*if(ctrl + d pressed){             scanner.close();         }*/     } } 


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

python - RuntimeWarning: PyOS_InputHook is not available for interactive use of PyGTK -