• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

question

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java -ea:favorite.fruits -da:favorite.fruits.Apple favorite,fruits.Mango

i just want to know if favorite.fruits.Mango has been disabled

thanks
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Zhaozhe, welcome to JavaRanch!

Do you think you could write some code to test this?
 
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java -ea:favorite.fruits -da:favorite.fruits.Apple favorite,fruits.Mango


I think there should not be space between Apple and favorite,and if you are not ending with a class you should use ... after package name ,like in first case i think favorite.fruits... should be there.

I have tried it before by giving many class names after -da or -ea but it is not working, only one expression is allowed ',' is not allowed.Even if you specify it will not report error at compile time.
 
Zhaozhe Ruan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The question is
The package favorite.fruits contains different classes for different fruits.Mango,Orange and Apple are some of the classes in this package.Assume that all the classes from this package are compiled with assertions enabled.Given the following command at the command prompt,which of hte following classes would have assertions enabled?
java -ea:favorite.fruits...-da:favorite.fruits.Apple favorite.fruits.Mango
A. favorite.fruits.Mango
B. favorite.fruits.Pineapple
C. favorite.fruits.Apple
D. favorite.fruits.Orange
E. net.util.FTPMan

result is ABD, could you explain why A, thanks
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mango, Pineapple, Orange and Apple are classes inside the package and when the first ea argument is encountered, assertion is enabled for all the classes in this package. Then the second argument da is encountered, assertion is disabled for the Apple class alone. The code runs the Mango class with assertion enabled for all classes except Apple. so, ABD is correct choice. I guess this is the reason. Not sure...
 
Let me tell you a story about a man named Jed. He made this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic