• 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

Boone 1.1 Mock #40

 
Rancher
Posts: 241
Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Question:
Construct an array of 3 String objects containing the strings "a", "b", "c", using the {} notation. Call the string by the variable name s.
Answer:
String s = {"a","b","c"};
shouldn't there be an indication of an array somewhere? I get a compiler error with this. My answer was String[] s = {"a","b","c"};
Eric
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my opinion ur answer is fine.
when u said :
shouldn't there be an indication of an array somewhere? I get a compiler error with this. My answer was String[] s = {"a","b","c"};
the "this" meant the previous code right?, cause ur code will not have a problem unless u try to declare it within a method.
Also the question is quite out of line when it says
"Call the string by the variable name s" it should have said,
"Call the array by the variable name s" or
"Call the string array by the variable name s"
Anybody has any other opinion??

 
Eric Barnhill
Rancher
Posts: 241
Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I did mean the previous code but it wasn't clear. Thanks for the reply.
Eric
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eric,
I also seen this qstn somewhere while I was preparing for the exam. But I don't remember what the author said. Where is this qstn from. We can move to Errata.
regds
maha anna
 
Eric Barnhill
Rancher
Posts: 241
Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I took it here but I don't think this is the official place for it.
Eric
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok. This post is all set to go to our Errata Forum. Thanks Eric.
regds
maha anna
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic