Javatpoint Logo
Javatpoint Logo

Java Class getSimpleName() Method

The getSimpleName() method of java Class class returns the simple name of the underlying class as given in the source code. In the case of an anonymous class, it returns an empty string.

Syntax

Parameter

NA

Returns

The simple name of the underlying class.

Throws

NA

Example 1

Test it Now

Output:

Class Name = ClassgetSimpleNameExample1
Class SimpleName = ClassgetSimpleNameExample1

Example 2

Test it Now

Output:

ClassgetSimpleNameExample2

Next TopicJava Class





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA