How to access a static method in a static way?
807569May 17 2006 — edited Aug 6 2006Hi,
I have written two program as below:
myProgram.java
public class myProgram{
testStatic ts;
public void test(){
ts = new testStatic();
int a = ts.myName();
}
}
testStatic.java
public class testStatic{
public static int myPrinter(){
System.out.println("This is testStatic class");
return 1;
}
}
When I compile the program, I got a warning at the line code
int a = ts.myName() of class myProgram indicationg that the static method myPrinter() from the type testStatic should be accessed in a static way.
How can i get ride of this warning sign by practising the correct way of accessing a static method?
Please guide.
Thank you!