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.*;
import static java.lang.System.*;
Moderator: admin
-
- Posts: 5
- Joined: Sun May 21, 2017 9:01 pm
- Contact:
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: import static java.lang.System.*;
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.
Who is online
Users browsing this forum: No registered users and 3 guests