Home » Java » java – How Scanner stops the flow of the program-Exceptionshub

java – How Scanner stops the flow of the program-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

How the methods of Scanner class stops the flow of a programm when called (for JOptionPane the same) because i want to use it in my program.

How to&Answers:

It prompts for interactive input on a single thread and will not continue until complete. If you started a second thread, it wouldn’t stop the flow for anything but that thread on which it executed

If you really want to know how it does it, openJDK source code is freely available