I have some classes A, B, C in package com.abc
I have a Class Main in package com.pqr
Now I want to create a package object of the previous pacakge (abc).
For this I tried,
Package pkg = Package.getPackage("com.abc"); // This gives me null object in pkg
But when I do,
Package pkg = A.class.getPackage(); // It works fine
Can anyone notify, Why Package.getPackage("package-name") is not working ?