package org.kodejava.lang;
import java.util.Calendar;
import java.math.BigDecimal;
public class ClassName {
public static void main(String[] args) {
// Get the name of the classes below.
Class<?> clazz = String.class;
System.out.println("Class Name: " + clazz.getName());
clazz = Calendar.class;
System.out.println("Class Name: " + clazz.getName());
clazz = BigDecimal.class;
System.out.println("Class Name: " + clazz.getName());
}
}
The result of the code snippet above are:
Class Name: java.lang.String
Class Name: java.util.Calendar
Class Name: java.math.BigDecimal
Latest posts by Wayan (see all)
- How do I get number of each day for a certain month in Java? - September 8, 2024
- How do I get operating system process information using ProcessHandle? - July 22, 2024
- How do I sum a BigDecimal property of a list of objects using Java Stream API? - July 22, 2024