was talking to this one idiot on msn, he was acting like he knew EVERYTHING, so i asked him about import static, and guess what? he logged
so il explain what import static can be used for.
we will use this test class:
Code:
public final class JClass {
private static final ActionHandler HANDLER_ACTION;
static {
HANDLER_ACTION = new ActionHandler();
}
public static void doAction() {
HANDLER_ACTION.IDKAMETHODNAME(IDKSOMEARGS);
}
}
now lets make a class that uses the static method JClass has
Code:
import static JClass.doAction;
public final class TestClass {
public TestClass() {
}
public void testVoid() {
doAction();
}
}
see the import static
Code:
import static JClass.doAction;
you can say this 'imports that method'
so instead of JClass.doAction(), you can just do doAction()
this applies to almost anything with the static modifier(including variables as long as they are not private)
so there now you know about static imports