Answers for "how to check object data type in java"

4

java check data type

a.getClass().getName()
Posted by: Guest on June-03-2021
2

how to check object type in java

// obj instanceof Class

/*example*/

String str = "a String made by the String class";

if(str instanceof String) System.out.println("This is True");
if(str instanceof float) System.out.println("This will never be on your screen");

// You can do this with any type of class you want!
Posted by: Guest on March-19-2021

Code answers related to "how to check object data type in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language