I'm working on java 5 "Static imports" Concept.
I have written 2 programs ,One is a client java file and other is a java file containing static entities as shown below.
Below is my client program where im trying to use static imports to import static entities from Static Test.
I have defined all the entites in my StaticTest.java file as "Static",but why am i still getting this error.???
Well Im using Eclipse IDE for this purpose.
The Path of my files are as below:
MyProject->src->(default package)->under this default package i have the files "StaticTest.java" and "StaticTestClient.java"
I will be highly obliged if you can help me out
When The Going Gets Tougher,The Tougher gets Going
I have given the static import declaration correctly itself,
Could you please look into again
Could you please tell me what is wrong in it?
Joined: Oct 13, 2005
I might have read the error incorrectly, but I think the Java Language Specification contains the explanation for that error. You usually omit the () after the name of a method in a "static import" declaration.
By the way: please don't write "hv," but "have." Explanation here.
Hi Deepak, you are dwelling on the wrong part of the spec. You are trying to import from the default package, which the spec says it is a compile time error to try to import from the unnamed (default) package. So you can not do what you want, you need to move the class you are importing from into a package.
Deepak Lal wrote:Hi Campbell,
Yes, i have read the link
It says the below for SingleStaticImportDeclaration: