Open In App

Class isInterface() method in Java with Examples

Last Updated : 05 Apr, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report
The isInterface() method of java.lang.Class class is used to check if this Class is an interface. The method returns true if this Class is an interface. It returns false otherwise. Syntax:
public boolean isInterface()
Parameter: This method does not accept any parameter. Return Value: This method returns true if this Class is an interface. It returns false otherwise. Below programs demonstrate the isInterface() method. Example 1:
Output:
Class represented by myClass: class Test
Is Test an interface: false
Example 2:
Output:
Is T an interface: true
Reference: https://docs.oracle.com/javase/9/docs/api/java/lang/Class.html#isInterface--

Next Article
Practice Tags :

Similar Reads