java.lang.Package.getPackages()


java.lang.Package.getPackages()

package com.codingdict;



public class PackageDemo {



   public static void main(String[] args) {



      // get all the packages

      Package[] pack = Package.getPackages();



      // print all packages, one by one

      for (int i = 0; i < pack.length; i++) {

         System.out.println("" + pack[i]);

      }

   }

}