Rounding java. lang. reflect. Modifier. isInterface of method

  • 2020-11-03 22:11:56
  • OfStack

Rounding java. lang. reflect. Modifier. isInterface () method

java. lang. reflect. Modifier. isInterface (int mod) method to judge if a given mod parameter contains final modifiers, return true, otherwise returns false.

The statement

Here are java. lang. reflect. Modifier. isInterface () method statement.


public static boolean isInterface(int mod)

parameter

mod-1 group of modifiers.

The return value

If mod contains the interface modifier, true; Otherwise: false.

The sample

The following example shows java. lang. reflect. Modifier. isInterface (int mod) the use of the 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's compile and run the above program, which will produce the following result -


true

If you have any questions, please leave a message or go to this site community exchange discussion, thank you for reading, I hope to help you, thank you for your support to this site!


Related articles: