How to write scanner once and use it in multiple classes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to write scanner once and use it in multiple classes

I tried using public static Scanner sc but it still gives error in other classes

12th May 2021, 4:16 PM
Vishal Jadhav
Vishal Jadhav - avatar
2 Answers
0
Where's the code you wrote which threw the error
12th May 2021, 4:32 PM
Ananiya Jemberu
Ananiya Jemberu - avatar
0
Scanner class is used once in main method otherwise you need to call the place where you have used it
12th May 2021, 5:16 PM
Atul [Inactive]