is namespace same as package in java?
There's no such term as "namespace" in Java - a package acts as a namespace in Java though, in terms of providing a scope for names. It's also part of the accessibility model. From section 7 of the Java Language Specification: Programs are organized as sets of packages.