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
Post a Comment