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 create a servlet filter to make secure cookies? - April 18, 2024
- How do I configure secure cookies using web.xml? - April 18, 2024
- How do I create a table with multiple header in iText 8? - March 16, 2024