Page 1 of 1

import static java.lang.System.*;

Posted: Tue Mar 27, 2018 11:23 pm
by Shri Shri
Although i got my answer right because 3 incorrect options started with "static import...", i am not clear with why option import static java.lang.System.*; is correct.

Also clear that we have to import all static elements of that class or explicitly mention the member name like
static java.lang.Integer.MAX_VALUE.

But what is significance of import static java.lang.System.*;

Re: import static java.lang.System.*;

Posted: Wed Mar 28, 2018 12:46 am
by admin
Did you read the explanation given with this option -
The code uses out.println instead of System.out.println. out is a static field in java.lang.System class. That is why you need to import the static fields of java.lang.System.