• 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

chapter 1 practice question 23 (Java OCA 8 Programmer I Study Guide, Sybex)  RSS feed

 
Greenhorn
Posts: 29
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the exam for first chapter at question 23 the answer is wrong (Answer :C,D ).
It must be only C , javac compiles a .java file into a .class file.
Option D is incorrect. Java doesn't take name of the class as parameter. The args[0] will be equal with the first String after the name of the class.
 
Sheriff
Posts: 11604
178
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Claudiu Stroe wrote:Option D is incorrect. Java doesn't take name of the class as parameter. The args[0] will be equal with the first String after the name of the class.


The study guide is spot-on! Both answers C and D are correct.

Probably the root cause of your thought/assumption is a misunderstanding of parameters and program arguments. You can pass several parameters to the java command. Some of them will be interpreted as options, one will be the class name and some will be passed to the program as arguments. Let's have a look at the java commandSo the first parameter which is not an option, is the name of the class to be called. Other parameters after this will be passed to the class as program arguments.

So options D, E, and F are nothing more than textual descriptions of these possible invocations and you have to select the correct oneAnd obviously option D is the correct one

Hope it helps!
Kind regards,
Roel
 
Claudiu Stroe
Greenhorn
Posts: 29
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Roel.
Your explication is really helpful, like always.

I don't know why I complecate simple questions
 
Roel De Nijs
Sheriff
Posts: 11604
178
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Claudiu Stroe wrote:I don't know why I complecate simple questions


On the actual exam the number of correct answers you must select is mentioned, so you probably would have selected the correct answers if you knew you had to select 2 answers (because all four other options are more wrong than option D).
 
A teeny tiny vulgar attempt to get you to buy our stuff
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!