Check out example codes for "get type of variable java". It will help you in understanding the concepts better.

Code Example 1

((Object) myVar).getClass().getName()
((Object) myInt).getClass().getSimpleName()

Code Example 2

Integer number = 15;

//This print to console the fully qualified name of the class, which for the example is:

//If you want a more concise output, you can use instead:

//getSimpleName() give you only the name of the class:

//Printing the type of primitive variables is a bit more complex: see this 
//for details.

Learn ReactJs, React Native from