Java Class getInterfaces() Method

The getInterfaces() method of java Class class returns the interfaces directly implemented by the class or the interface represented by the current object.

Syntax

Parameter

No parameter is passed.

Returns

An array of interfaces.

Throws

Does not throw an exception.

Example 1

Test it Now

Output:

Class :: java.lang.Thread
Classes :: [class java.lang.Thread$State, interface java.lang.Thread$UncaughtExceptionHandler]
Interfaces :: [interface java.lang.Runnable]

Example 2

Test it Now

Output:

interface java.io.Serializable
interface java.lang.Runnable

Next TopicJava Class




Latest Courses