Javatpoint Logo
Javatpoint Logo

Java Class getCanonicalName() Method

The getCanonicalName() method of java Class class returns the canonical name of the class as defined by the Java Language Specification. Otherwise, it returns Null.

Syntax

Parameter

No parameter is passed.

Returns

The canonical name of the underlying class if it exists, otherwise Null.

Throws

Does not throw an exception.

Example 1

Test it Now

Output:

Class Canonical Name = ClassgetCanonicalNameExample1
Class Simple Name   = ClassgetCanonicalNameExample1

Example 2

Test it Now

Output:

Class = ClassgetCanonicalNameExample2

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