+ 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
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.
+ 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.
+ 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.