Determine if object is integer

后端 未结 3 415
时光说笑
时光说笑 2021-01-17 10:00

How to determine if Object is Integer? Something like:

if (obj.isInteger()) {...}
相关标签:
3条回答
  • 2021-01-17 10:30
    if(ob instanceof Integer)
    
    { your code/logic here}
    
    0 讨论(0)
  • 2021-01-17 10:33
    if (obj instanceof Integer) {....}
    
    0 讨论(0)
  • 2021-01-17 10:40

    You may use Class.isInstance() method - This method is the dynamic equivalent of the Java language instanceof operator.

    0 讨论(0)
提交回复
热议问题