Java Class getPackage() Method

The getPackage() method of java Class class returns the package name of the class.

Syntax

Parameter

NA

Returns

The int representing the modifiers for this class.

Throws

The package of this class.

Example 1

Test it Now

Output:

Class ::: java.lang.Integer
Package ::: package java.lang, Java Platform API Specification, version 1.8

Example 2

Test it Now

Output:

Class
java.util

Next TopicJava Class




Latest Courses