Java Reflection - Java Constructor.isVarArgs()








Syntax

Constructor.isVarArgs() has the following syntax.

public boolean isVarArgs()

Example

In the following code shows how to use Constructor.isVarArgs() method.

import java.lang.reflect.Constructor;
import java.util.ArrayList;
//from w  ww . jav  a2 s .c om
public class Main {
  public static void main(String[] argv) throws Exception {
      Constructor[] constructors = ArrayList.class.getDeclaredConstructors();

      for (int i = 0; i < constructors.length; i++) {
        Constructor c = constructors[i];
        System.out.println(c.isVarArgs());
      }
    }
  
}

The code above generates the following result.