Java examples for Reflection:Class
get Class Package
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { Class classInstance = String.class; System.out.println(getClassPackage(classInstance)); }// www . jav a 2s.c om public static Package getClassPackage(Class<?> classInstance) { Package p; p = classInstance.getPackage(); if (p != null) return p; else { return null; } } }