package org.kodejava.lang;
public class CheckForInterface {
public static void main(String[] args) {
// Checking whether Cloneable is an interface or class
Class<?> clazz = Cloneable.class;
boolean isInterface = clazz.isInterface();
System.out.println(clazz.getName() + " is an interface = " + isInterface);
// Checking whether String is an interface or class
clazz = String.class;
isInterface = clazz.isInterface();
System.out.println(clazz.getName() + " is an interface = " + isInterface);
}
}
java.lang.Cloneable is an interface = true
java.lang.String is an interface = false
Latest posts by Wayan (see all)
- How do I calculate days between two dates excluding weekends and holidays? - January 12, 2023
- How do I discover the quarter of a given date? - January 11, 2023
- How do I export MySQL database schema into markdown format? - January 10, 2023