Home >Java >javaTutorial >Detailed explanation of examples of .lang.reflect.Modifier.isInterface() method in java
This article mainly introduces the relevant information about the java.lang.reflect.Modifier.isInterface() method. Here are examples to help you understand the use of this method. Friends in need can refer to it
Detailed explanation of java.lang.reflect.Modifier.isInterface() method
java.lang.reflect.Modifier.isInterface(int mod) method determines if the given mod parameter contains the final modifier, then Returns true, otherwise returns false.
Declaration
The following is the declaration of the java.lang.reflect.Modifier.isInterface() method.
public static boolean isInterface(int mod)
Parameters
mod - A set of modifiers.
Return value
True if the mod contains the interface modifier; otherwise: false.
Example
The following example shows the usage of java.lang.reflect.Modifier.isInterface(int mod) method.
package com.yiibai; import java.lang.reflect.Modifier; public class ModifierDemo { public static void main(String[] args) { System.out.println(Modifier.isInterface(SampleClass.class .getModifiers())); } } interface SampleClass { String getSampleField(); }
Let us compile and run the above program, this will produce the following results -
true
The above is the detailed content of Detailed explanation of examples of .lang.reflect.Modifier.isInterface() method in java. For more information, please follow other related articles on the PHP Chinese website!