Answers for "how to check type of value by java"

3

how to check type of primitive value in java

int i = 20;
float f = 20.2f;
System.out.println(((Object)i).getClass().getName());
System.out.println(((Object)f).getClass().getName());
Posted by: Guest on May-21-2020
3

get type of variable java

((Object) myVar).getClass().getName()
//OR
((Object) myInt).getClass().getSimpleName()
Posted by: Guest on September-20-2020

Code answers related to "how to check type of value by java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language