Click here to watch in Youtube :
https://www.youtube.com/watch?v=8BHbzgq3MoQ&list=UUhwKlOVR041tngjerWxVccw
Java Tutorial : Java Static Import |
Java Tutorial : Java Static Import |
WithOutStaticImportExample.java
StaticImportExample.javaimport java.lang.*; /** * * Example of With out Static import. * */ public class WithOutStaticImportExample { public static void main(String[] args) { int minValue = Math.min(2, 10); // with out static import System.out.println("minValue : " + minValue); int maxValue = Math.max(12, 20); // with out static import System.out.println("maxValue : " + maxValue); System.out.println("PI : " + Math.PI); // with out static import } }
import static java.lang.Math.*; /** * * Example of Static import. * */ public class StaticImportExample { public static void main(String[] args) { int minValue = min(2, 10); System.out.println("minValue : " + minValue); int maxValue = max(12, 30); System.out.println("maxValue : " + maxValue); System.out.println("PI : " + PI); } }
minValue : 2 maxValue : 20 PI : 3.141592653589793
To Download StaticImportDemoApp Project Click the below link
See also:
No comments:
Post a Comment