Thursday, July 10, 2014

Static Import in Java


  • import static java.lang.Math.PI;
double r = cos(PI * theta);

http://viralpatel.net/blogs/static-import-java-example-tutorial/

  • Static import can reduce code size and allow you to freely use static field of external class without prefixing class name on that
http://javarevisited.blogspot.com/2012/10/what-is-static-import-in-java-5-example-tutorial.html#ixzz370mlCrPP

No comments:

Post a Comment