Wednesday, November 18, 2009

Basics: Static Import

Static members of a class are called by prefixing their names with a period (.) operator and then the class name.
Classname.methodName(arguments);
If a program requires many static members from a single class, then static import feature can be used, to avoid prefixing the classname when calling the class members

Consider the Math class, which has many static members. By adding the following code, you don't have to write Math in front of every math class member.

tutorials

No comments:

Post a Comment