0

How to Use Two Scanner in Java.

Please Help me I want Two Scanner in Java but i don't know how to use two scanner.

5th Jan 2021, 9:22 AM
Coolzzz
Coolzzz - avatar
10 odpowiedzi
+ 7
So you want something like this? https://code.sololearn.com/c9sYfM6fJ3vT/?ref=app You just create one Scanner object for that. Scanner sc = new Scanner(System.in); Then with the help of the Scanner object sc you call your required methods and assign them to appropriate variables. e.g. int a = sc.nextInt(); int b = sc.nextInt();
5th Jan 2021, 9:36 AM
Minho
Minho - avatar
+ 6
Can you please elaborate a little more? Where and how you're supposed to use Scanner class?
5th Jan 2021, 9:28 AM
Minho
Minho - avatar
+ 4
You're welcome 😊
5th Jan 2021, 9:41 AM
Minho
Minho - avatar
0
I was Using two int to take two numbers and then add,divide, multiply or subtract a number chosen by the user. I just Want to use first Scanner to take the first number and then second Scanner to take Second Number. Please help me
5th Jan 2021, 9:32 AM
Coolzzz
Coolzzz - avatar
0
Can I take two input using one Scanner??
5th Jan 2021, 9:37 AM
Coolzzz
Coolzzz - avatar
0
Like I can use sc to take two input in a and b.
5th Jan 2021, 9:38 AM
Coolzzz
Coolzzz - avatar
0
Let me check
5th Jan 2021, 9:39 AM
Coolzzz
Coolzzz - avatar
0
Ya It is Working Thank You.
5th Jan 2021, 9:40 AM
Coolzzz
Coolzzz - avatar