Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jar file statement (true or false)

 
Ali Khalfan
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the master exam, one of the questions says this:


A JAR file can contain classes from only a single package

This looks to be true..yet the answer guide says this is false, why can't I have one package in the archive?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is "the master exam"? Please QuoteYourSources.

A jar file can contain classes from any number of packages.
 
Ali Khalfan
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Master Exam is a software that has questions on a cd that came with the K&B book

The statement should be true shouldn't it ?
 
Ali Khalfan
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok I guess I misunderstood the question.

The only word here must mean 'A jar must only contain one file'

I hope I don't fall in the pitfall again
 
neil keefe
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I registered in here just so that I could complain about this particular answer!

Yes, a JAR file *can* contain classes from only a single package. It can also contain classes from more than one package.

This is ambiguous at best. If they phrased it plainly:

A JAR file can only contain classes from a single package.

The answer would be too obvious. So the question is relying on ambiguity in English for its difficulty, rather than on your knowledge of the principle at play.

Alas I have only one packet of seeds. Can I plant seeds in my garden, from only a single packet? Yes, I can. And if I had many packets of seeds, I could plant seeds from many packets. It's my choice!

 
Ankit Garg
Sheriff
Posts: 9529
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, a JAR file *can* contain classes from only a single package. It can also contain classes from more than one package.

neil the book never says that the JAR file cannot contain classes from only a single package. The way I see it, the statement in the book is correct. The statement that "a JAR file can contain classes from only a single package" is wrong. This doesn't mean that the JAR file *must* contain classes from multiple package. Even you can create an empty JAR file with no classes from any package. When the book says that the statement is wrong, it means that the JAR file can contain classes from many packages, so it means >=0 i.e. it can contain classes from zero, one or more packages...
 
neil keefe
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit I understand what the book was getting at. The problem is the statement can be interpreted another way, depending on where the emphasis is placed:

Your garden can be planted using only one packet of seeds.

Sounds like: Your garden can be planted using one and only one packet of seeds. (the author's intent--false)

Your garden can be planted using only one packet of seeds.

Sounds like: Your garden can be planted using merely one packet of seeds. (true)

When it's written we cannot see the emphasis, so there is no way to tell which version represents the writer's intent. Until you look up the answer. The fact that we commenters must resort to various *tricks* to indicate the emphasis is a clue something's wrong. So either can be valid it seems to me, depending on how you read the sentence aloud. The authors obviously meant the "one and only one" way, but I read it the "merely" way, and so did Ali and probably many others. Good thing it's only a practice question!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic