Find the Package of an Object
import java.util.ArrayList; import java.util.Vector; public class Main { public static void main(String[] args) { System.out.println(new Vector().getClass().getPackage().getName()); System.out.println(new ArrayList().getClass().getPackage().getName()); System.out.println("Test String".getClass().getPackage().getName()); System.out.println(new Integer(1).getClass().getPackage().getName()); } } /* java.util java.util java.lang java.lang */