If you change your job, you need to pick up Java again. Although the language used in college is not complicated, there are still some strange places. For example, Static Import.
Static Import is a feature introduced in JDK 1.5, but I really didn't notice it when I was in college. Its role is to enter the static method or constant Import. for example:
Import Static Java.lang.math.*; Public Class HelloWorld {Public Static Void Main (String [] ARGS) {System.out.println ("Hello World!"); System.out.pr. Intln ("Considering a Circle with a Diameter of 5 cm, it has: "); System.out.println (" a circumference of " + (math.pi * 5) +" cm "); Math.pi * math.pow (2.5,2)) + "sq. cm");}}
After using Static Import, you can write it:
Import Static Java.lang.math.*; Import Static Java.lang.System.Out; Public Class HelloWorld {Public Static void Main (String [] ARGS) {Out.println ("h ello World! "); Out.println ( "Considering A Circle with a Diameter of 5 cm, it has:"); out.println ("a circumference of" + (Pi * 5) + "cm"); out.println ("And An Area of" + ( PI * POW (2.5, 2)) + "sq. Cm");}}
Note that "math." And "system." Can be omitted.
STATIC Import and Import rules are similar, and the referenced content cannot be ambiguous.
With the Static Import, the code will become shorter and increases readability, but to a certain extent, it will cause difficulties in the overall understanding of the code, because constant and static methods look like global and global methods. Lost some OO beauty.