How to get Package information for a given class in java

Example

package com.pretech;
public class PackageInfoExample {
	public static void main(String[] args) {
		Class<String> clazz = String.class;
		Package pack = clazz.getPackage();
		System.out.println(pack);
		System.out.println(pack.getImplementationTitle());
		System.out.println(pack.getName());
		System.out.println(pack.getSpecificationTitle());
	}
}

Output



package java.lang, Java Platform API Specification, version 1.7
Java Runtime Environment
java.lang
Java Platform API Specification


No comments:

Post a Comment

Confusion Matrix + Precision/Recall (Super Simple, With Examples)

  Confusion Matrix + Precision/Recall (Super Simple, With Examples) 1) Binary Classification Setup Binary classification means the model p...

Featured Posts