Taking input from user using constructor | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Taking input from user using constructor

hi, please tell me how to take input input data from user if we have used parameterized constructor in our java class?

13th Oct 2018, 5:08 AM
S.K
1 Answer
+ 4
You should use Scanner: import java.util.Scanner; Scanner s =new Scanner(System.in); String input = s. nextLine(); //use nextFloat for a float, nextDouble for a double....
13th Oct 2018, 5:43 AM
Daniele Bonomi
Daniele Bonomi - avatar