java print type of object
//Example:
Integer number = 15;
System.out.println(number.getClass().getName());
//This print to console the fully qualified name of the class, which for the example is:
java.lang.Integer
//If you want a more concise output, you can use instead:
System.out.println(number.getClass().getSimpleName());
//getSimpleName() give you only the name of the class:
Integer
//Printing the type of primitive variables is a bit more complex: see this
//https://stackoverflow.com/questions/180097/dynamically-find-the-class-that-represents-a-primitive-java-type
//for details.
Also in Java:
- how to remove all items from alist in java
- length of string java
- entre clavier java
- sort elements with sortedset
- do while loop java
- java regex replace all characters before
- java stream sort
- action on long press of edit edittext
- reentrantreadwritelock java
- bukkit java get max players
- create notification android
- store string elements in character array in java
- java set example
- java how to make a gui
- java random integer
- array null pointer java
- HOW TO SUPRESS sonar warning in java code
- how to do for each in java
- java for
- delete element from arraylist
- remove last character from string java
- how to use for loop for array in java
- change java version command line debian
- java flood fill