Constructor getName() method in Java with Examples Last Updated : 29 Oct, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The constructor class provides information about a single constructor for a class and it also provides access to that constructor. The getName() method of java.lang.reflect.Constructor is used to return this constructor name, as a string. Constructor name is the binary name of the constructor's declaring class. Syntax: public String getName() Parameters: This method accepts nothing. Return: This method returns the simple name of the underlying member in String format. Below programs illustrate getName() method: Program 1: Java // Java program to illustrate getName() method import java.lang.reflect.Constructor; public class GFG { public static void main(String[] args) { // create a class object Class classObj = String.class; // get Constructor object array // from class object Constructor[] con s = classObj.getConstructors(); // apply getName method System.out.println("Constructor : " + cons[0].getName()); } } Output: Constructor : java.lang.String Program 2: Java // Java program to illustrate getName() method import java.lang.reflect.Constructor; import java.util.ArrayList; public class GFG { public static void main(String[] args) { // get Constructor object for class object Constructor constructor = ArrayList.class.getConstructors()[0]; // apply getName method String name = constructor.getName(); // print result System.out.println("Constructor Name : " + name); } } Output: Constructor Name : java.util.ArrayList References: https://docs.oracle.com/javase/10/docs/api/java/lang/reflect/Constructor.html#getName(java.lang.Object) Comment More infoAdvertise with us Next Article Constructor getName() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Constructors Java-Functions java-lang-reflect-package Practice Tags : Java Similar Reads Class getName() method in Java with Examples The getName() method of java.lang.Class class is used to get the name of this entity. This entity can be a class, an array, an interface, etc. The method returns the name of the entity as a String.Syntax: public String getName() Parameter: This method does not accept any parameter.Return Value: This 1 min read Constructor getDeclaringClass() method in Java with Examples The constructor class provides information about a single constructor for a class and it also provides access to that constructor. The getDeclaringClass() method of java.lang.reflect.Constructor is used to return the class object representing the class that declares the constructor represented by th 2 min read Class getTypeName() method in Java with Examples The getTypeName() method of java.lang.Class class is used to get the type name of this class, which provides the information about this class' type. The method returns the type name of this class in the form of String. Syntax: public String getTypeName() Parameter: This method does not accept any pa 2 min read Class getSimpleName() method in Java with Examples The getSimpleName() method of java.lang.Class class is used to get the simple name of this class, as given in the sourcecode. The method returns the simple name of this class in the form of String. If this class is anonymous, then this method returns empty string.Syntax: public String getSimpleName( 2 min read Class forName() method in Java with Examples The forName() method of java.lang.Class class is used to get the instance of this Class with the specified class name. This class name is specified as the string parameter.Syntax: public static Class<T> forName(String className) throws ClassNotFoundException Parameter: This method accepts the 1 min read Like