How to put scanner in abstract class? Using java.

I am a beginner please help me. Thanks.

8th Sep 2020, 12:41 PM
Nasser Hilla
Nasser Hilla - avatar
1 Answer
+ 1
You need in abstract class which will belong to the class rather then the instance's of this class. static Scanner sc = new Scanner(System.in); This way all instances will share the same scanner.
8th Sep 2020, 1:02 PM
D_Stark - avatar