• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

please elaborate this ?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in Boyarsky Selikoff-Oracle Certified Associate Java SE 8 Programmer I Study Guide Exam 1Z0-808-2014
page no.11


it is written like why it is written like The answer is that three of the imports are redundant. Lines 1 and 2 are redundant because everything in java.lang is automatically considered to be imported.
at least one out of this two line will be needed right to import it
please reply as soon as possible
Regards
SNAG-0000.jpg
[Thumbnail for SNAG-0000.jpg]
page picture
 
Saloon Keeper
Posts: 3291
146
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But what is your question? Don't you agree with the given answer?

Rishit Shah wrote:at least one out of this two line will be needed right to import it


If you mean the lines 3 and 4, then it is exactly one of these lines (not 'at least') that is needed.
 
Marshal
Posts: 64635
225
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for providing the full details of the question . We only use words like “urgent”, “as soon as possible”, or similar on 1st April
What that bit of code is probably intended to show is that multiple imports are permissible. Tell me what will happen if you try to compile and run the following code, which is quite similar to what you posted:-Also tell me: if you actually persuade that code to run many times, how often will it print “10”?
 
Rishit Shah
Greenhorn
Posts: 5
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok  I got it
in Java System.lang is not necessary  to import as it automatically get imported
thank you for you kind reply
i am in java and also in coderanch to so dont know much function and option thank you guys
 
Campbell Ritchie
Marshal
Posts: 64635
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and what happened when you tried to compile my version of that code? How often do you expect it to print “10”?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!