We can know object reference is-a test by using instanceof operator. But is there any operator to check primitive types. For example:
byte b = 10;
If you really want to play with literals...
if(Byte.class.isInstance(10)) {
System.out.println("I am an instance of Byte");
}
if(Integer.class.isInstance(10)) {
System.out.println("Ups, I can also act as an instance of Integer");
}
if(false == Float.class.isInstance(10)) {
System.out.println("At least I am not a float or double!");
}
if(false == Byte.class.isInstance(1000)) {
System.out.println("I am too big to be a byte");
}