Get package

ReturnMethodSummary
PackagegetPackage()Gets the package for this class.

public class Main {

  public static void main(String[] args) {

    
    Class c = new String().getClass();
    Package pack = c.getPackage();
    
    System.out.println(pack);
    

  }
}

The output:


package java.lang, Java Platform API Specification, version 1.6
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.