Java Class getInterfaces() Method21 Mar 2025 | 1 min read The getInterfaces() method of java Class class returns the interfaces directly implemented by the class or the interface represented by the current object. SyntaxParameterNo parameter is passed. ReturnsAn array of interfaces. ThrowsDoes not throw an exception. Example 1Output: Class :: java.lang.Thread Classes :: [class java.lang.Thread$State, interface java.lang.Thread$UncaughtExceptionHandler] Interfaces :: [interface java.lang.Runnable] Example 2Output: interface java.io.Serializable interface java.lang.Runnable Next TopicJava Class |
Java Class Method The method of java Class class checks if the specified Class object represents a primitive type. Syntax public boolean Parameter NA Returns true if and only if this class represents a primitive type. Throws NA Example 1 public class ClassisPrimitiveExample1 { public static void main(String... args) { ...
1 min read
class class instances represent the classes and interfaces in a running java application. Every Array belongs to a class is a Class object and it is shared by all arrays (with same element type and number of dimensions). Methods Method Description asSubclass(Class<U> clazz) It casts this Class object to represent a...
6 min read
Java Class Method The method of java Class class returns an array containing the method objects which represent all the public methods of the class or interface represented by a Class object, including those declared by the class or interface and inherited from superclasses...
2 min read
Java Class Method The method of java Class class determines if this Class object represents an array class. Syntax public boolean Parameter NA Returns true if this object represents an array class. Throws NA Example 1 import java.lang.*; public class ClassisArrayExample1 { public static void main(String[] args) { ...
1 min read
Java Class Method The method of Java Class class returns the Class object associated with the class or interface with the given name in the parameter as String. Syntax This method is overloaded in the following ways. public static Class<?> forName(Module module, String name) public static Class<?>...
2 min read
Java Class Method The method of java Class class returns true if this Class object represents an annotation type. Here, we must notice that if this method returns true, isInterface() would also return true, as all annotation types are also interfaces. Syntax public boolean Parameter NA Returns true, if...
1 min read
Java Class Method The method of java Class class returns the assertion status that would be assigned to this (current class object) class, if it is to be initialized at the time method is invoked. If the assertion status is already set, the...
2 min read
Java Class Method The method of java Class class returns this element's annotation for the specified type if such an annotation is present, otherwise returns the null. Syntax public <A extends Annotation> A getAnnotation(Class<A> annotationClass) Parameter A - the type of the annotation to query for and return...
1 min read
Java Class Method The method of java Class class returns an array of the objects of the type AnnotatedType that represents the use of types to specify superinterfaces of the entity represented by this(Current class object) Class object. Syntax public AnnotatedType[] Parameter No parameter is passed. Returns An array...
2 min read
Java Class Method The method of java Class class returns a field object which represents the public member field of the class or interface represented by this Class object. A string specifying the simple name of the desired field is passed as the parameter. Syntax public...
2 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India