• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

abt 'import' keyword

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
this is the ques from javaprepare sample test 1
Q55..Which of the following are correct.
An import statement, if defined, must be the first statement of the file.
given ans is : false
but i think it is true,as it does not mentioned 'package' is defined.if 'package' is defined ,'package' must be first noncomment statement.
am i wrong ?
manila
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The answer is tricky. You are right. Here it is saying MUST. You must understand the difference between MUST and MAY. If it was import statement may be the first statement, then your answer would have been right.
Anyways, I still agree with you. I think most of the people would have answered what you answered.
Thanks,
Antra
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
"Import statement, if defined " - Pls note the sentence....
If it is defined in a file that has a statement abt a package
declaration then the order is as follows :
a) Package Declarations
b) Import statements
c) Class definitions
In fact this is the general order as given in RHE
Praveen Zala
 
Bras cause cancer. And tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic