Source Code : Static Import
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Static Import
////////Fruits.java
package MyConstants;
public class Fruits {
public static int apple = 500;
public static int pear = 501;
public static int orange = 502;
public static int banana = 503;
public static int strawberry = 504;
}
////////////Colors.java
package MyConstants;
public class Colors {
public static int white = 0;
public static int black = 1;
public static int red = 2;
public static int blue = 3;
public static int green = 4;
public static int orange = 5;
public static int grey = 6;
}
///////////////////////StaticTest.java
import static MyConstants.Colors.*;
import static MyConstants.Fruits.*;
public class StaticTest {
public static void main(String args[])
{
System.out.println("orange = " + orange);
System.out.println("color orange = " + Colors.orange);
System.out.println("Fruity orange = " + Fruits.orange);
}
}
Thank with us