Mega Code Archive

 
Categories / Java Book / 008 Reflection
 

0472 Get the string representation of the Package

String toString() Returns the string representation of this Package. Revised from Open JDK source code public class Main { public static void main(String[] args) { Package pkg = Package.getPackage("java.lang"); System.out.println("Name: " + pkg.getName()); System.out.println("Implementation title: " + pkg.getImplementationTitle()); System.out.println("Implementation vendor: " + pkg.getImplementationVendor()); System.out.println("Implementation version: " + pkg.getImplementationVersion()); System.out.println("Specification title: " + pkg.getSpecificationTitle()); System.out.println("Specification vendor: " + pkg.getSpecificationVendor()); System.out.println("Specification version: " + pkg.getSpecificationVersion()); System.out.println("Sealed: " + pkg.isSealed()); System.out.println("Compatible: " + pkg.isCompatibleWith("1.3")); } }