Java Package reflection

Introduction

The following program displays the packages about the program:


// Demonstrate Package
public class Main {
  public static void main(String args[]) {
    Package pkgs[];/*from   ww w .jav  a2s  . c o m*/

    pkgs = Package.getPackages();

    for(int i=0; i < pkgs.length; i++)
      System.out.println(
             pkgs[i].getName() + " " +
             pkgs[i].getImplementationTitle() + " " +
             pkgs[i].getImplementationVendor() + " " +
             pkgs[i].getImplementationVersion()
      );

  }
}



PreviousNext

Related