• 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

Interpreting Question

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got this question, should i take it that the command line was "java hello there" or "java Arg hello there". I've got samples before where both scenarios apply and as this is a sample from Oracle, I wanted to make sure how to interpret it for the exam.





Compile time error
Compilation and output of "hello"
Compilation and output of "there"
None of the above
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It takes less than 3 minutes to test. please give a try!
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

that would be a compile time error because of accessing a non-static field (MyArg) from within a static method (main in this case).
 
ai dan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know what the outcome is when its run properly, but the question says

with the command line "hello there"

Does that mean I should take it that the command line is "java hello there" or "java Arg hello there" I know for the first option, this wouldn't run but that's why I wanted to check as one of the answers is none of the above.
I know the problems with the code but want to check that "if it did compile" and i got a question stating "with the command line 'hello there'" how should this be interpreted because it could have said with the arguments hello there which would have been clearer.
 
Mehmet Gunacti
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
take it as "java Arg hello there".

IMO you should stop thinking about that question after finding the correct answer.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic