Java Constructor.isSynthetic()
Syntax
Constructor.isSynthetic() has the following syntax.
public boolean isSynthetic()
Example
In the following code shows how to use Constructor.isSynthetic() method.
import java.lang.reflect.Constructor;
import java.util.ArrayList;
// ww w .j a v a 2s . co m
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.isSynthetic());
}
}
}
The code above generates the following result.