Home > Java > javaTutorial > Detailed explanation of examples of .lang.reflect.Modifier.isInterface() method in java

Detailed explanation of examples of .lang.reflect.Modifier.isInterface() method in java

黄舟
Release: 2017-09-07 10:22:07
Original
1899 people have browsed it

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)
Copy after login

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();
}
Copy after login

Let us compile and run the above program, this will produce the following results -


true
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template