+ 1

how to take input from user and store it in an object?

I want to use instanceOf on that variable for checking the type of input data

16th Jul 2016, 12:33 PM
Preeti.Bhushania
Preeti.Bhushania - avatar
3 ответов
+ 2
You can either use InputStreamReader or Scanner class to get input from the user and then you can store it in an object.
16th Jul 2016, 3:31 PM
Mohit Gupta
Mohit Gupta - avatar
+ 1
but it's taking input either as primitive datatype or string. i want to store it in Object variable and then identify the value type using instanceOf.
16th Jul 2016, 4:57 PM
Preeti.Bhushania
Preeti.Bhushania - avatar
+ 1
Yes it takes input as primitive. Do one thing, wrap the primitive to its wrapper class and then you can treat them as Object variable. Wrapper for example, Integer for int.
16th Jul 2016, 6:12 PM
Mohit Gupta
Mohit Gupta - avatar