nirjari patel wrote: If I have created a class "testSpecifier1.java" with access specifier as protected , in package testClasses, I can access this class anywhere in same package.
I have to import package in a class to use content from that package. So if I create another class "testSpecifier2.java" in the same package testClasses, do I need to import this package in the beginning of the coding ? Or can I access content within same package without importing package ?
Please try to implement this by writing a simple code. So that you can get a first hand experience of how things work.
nirjari patel wrote: How doea this work with static methods ? As static methods dont need the class to be instantiated. If I dont need to import package to be imported for use in another class within same package, what if there are two static method by the same name in two different classes ? Do I need to specify class name before the static method name in order to specify what static methid I want to use ? If there is unique static method in a class which is unique in package, do I still need to specify the class name in order to use this static method ?
I think you are talking about Static imports-
http://download.oracle.com/javase/1.5.0/docs/guide/language/static-import.html
Always better to avoid Static imports as it leads to confusion and difficult to maintain code.