java.lang.Class.getPackage()


java.lang.Class.getPackage()

package com.codingdict;



import java.lang.*;



public class ClassDemo {



   public static void main(String[] args) {



      try {

         Class cls = Class.forName("java.lang.Integer");



         // returns the name and package of the class

         System.out.println("Class = " + cls.getName());

         System.out.println("Package = " + cls.getPackage());

      } catch(ClassNotFoundException ex) {

         System.out.println(ex.toString());

      }

   }

}