eclipse - static keyword by itself in Java -
i know static is.. globally.
so looking through code, better in coding myself. i'm looking through minecraft source code, , interested there in files "tileentity.java" , "entitylist.java". not necessary on there, because manner of programming.
so, have regular class method:
public class entitylist{ public static void addmapping( /* variables dont matter */ ){ //call other methods, unimportant } }
after there class imported entitylist
, this:
import the.path.to.entitylist; public class tileentity{ static{ addmapping( /* vars */ ); addmapping( /* vars */ ); } }
now i'm wondering: how work? please let me know if need know more background of code, cannot redistribute file due copyright , stuff. have decompile minecraft if have yourself.
we can't see real code, guess contains static import:
import static the.path.to.entitylist.addmapping;
or
import static the.path.to.entitylist.*;
a static import allows referring static field or method of class without having type name of class.
see http://docs.oracle.com/javase/1.5.0/docs/guide/language/static-import.html more details.
Comments
Post a Comment