This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Array Question  RSS feed

 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This question is from JQ+
Which of the following correctly declare a variable which can hold an array of 10 integers?
Answers:
1. int[] iA
2. int[10] iA
3. int iA[]
4. Object[] iA
5. Object[10] iA
JQ+ says the answer is 1 and 3
I though 2 was the correct answer, can someone please explain this to me.
Thanks,
-Matt
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to watch the semantics on the test. I passed mine in December with an 86% and am sure that I didn't get my goal of above 90% because of questions like this.
The key here is an array that "can" hold 10 not "must" hold 10. Of course in order for this to actually hold 10 ints you would have to follow up with:

or

Hope this helps.
 
Matt Ghiold
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahhh, I get it thank's so much!
-Matt
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
And just to point out the obvious...
Option number 2 wouldn't even compile - no matter what you were to follow it up with.
Good Luck,
-Dirk Schreckmann
[ March 04, 2002: Message edited by: Dirk Schreckmann ]
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forgot to mention that yesterday! Good point.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!