• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

a=b,java

 
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In K & B, chapter-10, self test example-7,page-785.
Class name is a=b. It is invalid identifier. May be printing mistake.
 
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dolly,

I think that is what question is all about.

There is no named flag D for compiler javac.
java -Da=b c_d
setting name=value pair. name=value pair must follow -D without any space.
This is the thing you have to care for exam specifically.


From your couple of posts it seems you are giving final touch to your prep.
Isn't it?


Thanks,
 
dolly shah
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not really. I just want to clear my doubts before jump to another chapter. Still I am on mid way of prep.
About my doubt, a=b.java means a=b must be class name. Even one more mistake is c_d.class they have written at the place of class name. And also I am not getting you. Can you explained little more?
Thanks.
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dolly,

I agree, a=b.java is invalid file name.

a=b.java
c_d.class


A. java -Da=b c_d //Correct answer
B. java -D a=b c_d //incorrect because space after -D, don't get confused
a=b as file name as mentioned above
C. javac -Da=b c_d //incorrect, no option -D for javac (java compiler)
D. javac -D a=b c_d //incorrect on behalf of above




Even one more mistake is c_d.class they have written at the place of class name.



A class file is stored with .class extension. So no problem in c_d.class.
But while launching the class file you don't write c_d.class, what you
need is to give the class name as c_d.

And also I am not getting you.


I like this. I hope you get it now.

Thanks,
 
dolly shah
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Chandra. Now I got it.
 
catch it before it slithers away! Oh wait, it's a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic