Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 562
  • Last Modified:

Accepting input from user in Java

Hi

Which of the following is the formal/best method for accepting input from user and what library we need to import:

Scanner user_input = new Scanner( System.in );

InputStreamReader isr = new inputStreamReader(System.in)

Thanks
0
JRawabi
Asked:
JRawabi
1 Solution
 
JRawabiAuthor Commented:
forgot this:


Also this

System.out.print("Enter the input");
 usrInpt = scan.next();
0
 
krakatoaCommented:
java.util.Scanner. ;)
0
 
mrcoffee365Commented:
We use InputStreamReader usually, but krakatoa is right, Scanner works, too.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now