Java Class getPackageName() MethodThe getPackageName() method of java Class class is used to get the fully qualified name of the package. If no package name is specified, then it returns an empty string. SyntaxParameterNo parameter is passed. ReturnsReturn package name as a string. ThrowsNA Example 1Test it NowOutput: Class ::: java.lang.Integer.......... Package ::: package java.lang, Java Platform API Specification, version 1.8 Package Name ::: package java.lang, Java Platform API Specification, version 1.8 Example 2Test it NowOutput: Class Package1 Name::package Class java.util Package2 Name::package Class
Next TopicJava Class
|