Java Class getConstructors() Method

Last Updated : 17 Mar 2025

The getConstructors() method of java Class class returns an array which contains the constructor object reflected by the public constructors of this class. If no constructor is defined, it returns an array of length 0.

Syntax

Parameter

NA

Returns

An array of all the constructor.

Throws

SecurityException

Example 1

Output:

Frame Constructors::
Constructor  1::  public java.awt.Frame(java.lang.String,java.awt.GraphicsConfiguration)
Constructor  2::  public java.awt.Frame(java.lang.String) throws java.awt.HeadlessException
Constructor  3::  public java.awt.Frame(java.awt.GraphicsConfiguration)
Constructor  4::  public java.awt.Frame() throws java.awt.HeadlessException

Example 2

Output:

public ClassgetConstructorsExample2$Class1()
public ClassgetConstructorsExample2$Class1(int)
public ClassgetConstructorsExample2$Class1(java.lang.String,java.math.BigInteger[])
 
Next TopicJava Class