static import:
static import is slightly different from normal import.If we uses static import then we can access static data members of that class without qualify with that class name.
For Example:
import static java.lang.System.*;
public class Test
{
public static void main(String []args)
{
int age=25;
String name="vishwa";
out.println(age);
out.println(name);
}
}
Output: 25
vishwa
static import is slightly different from normal import.If we uses static import then we can access static data members of that class without qualify with that class name.
For Example:
import static java.lang.System.*;
public class Test
{
public static void main(String []args)
{
int age=25;
String name="vishwa";
out.println(age);
out.println(name);
}
}
Output: 25
vishwa
No comments:
Post a Comment