Numerical filter | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Numerical filter

How could i know if a given Object is Numerical(Integer,Double..) ???

6th Nov 2020, 9:06 PM
Michel Ghaith
Michel Ghaith - avatar
2 Answers
+ 5
Object obj1 = 123; Object obj2 = "abc"; System.out.println( obj1 instanceof Number ); // true System.out.println( obj2 instanceof Number ); //false
6th Nov 2020, 9:55 PM
_cm_
0
Martin Taylor My question is if i send an Object to a function as a parameter How could i know the type of object
6th Nov 2020, 9:48 PM
Michel Ghaith
Michel Ghaith - avatar