Javatpoint Logo
Javatpoint Logo

Java Class getClasses() Method

The getClasses() method of java Class class returns an array containing the Class objects which represents all the public classes and interfaces that are members of the class represented by the Class object.

Syntax

Parameter

NA

Returns

Returns an array of class object.

Throws

SecurityException

Example 1

Test it Now

Output:

Class  0  = ClassgetClassesExample1$subclass2
Class  1  = ClassgetClassesExample1$subclass1

Example 2

Test it Now

Output:

class ClassgetClassesExample2$MainSuperClass
class ClassgetClassesExample2$StaticClass
interface ClassgetClassesExample2$Interface1
class ClassgetClassesExample2$Class2
class ClassgetClassesExample2$Class1

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