This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Cattle Drive and the fly likes instructors solution for OOP-4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "instructors solution for OOP-4" Watch "instructors solution for OOP-4" New topic

instructors solution for OOP-4

Timo Richter

Joined: Dec 11, 2006
Posts: 10
Thanks Marilyn for the final nitpick on OOP-4 (Lookup) I tried to run the instructors solution but it didn't compile due to multiple public classes existing in the source file '':

My question:
Was it intended to divide the code, to create separate source-files for the classes Thing, Video, BookOnTape and Furniture and to compile then separately (this way it works on my machine)?

Pauline McNamara

Joined: Jan 19, 2001
Posts: 4012
Yep, you got it.

Oops, almost forgot... congratulations on getting through the OOPs part of the Cattle Drive!
[ October 22, 2007: Message edited by: Pauline McNamara ]
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9058
For convenience, it appears to be all in one file when we send assignments and solutions back and forth. However, in my opinion, it is better to keep one file per outer class.

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Timo Richter

Joined: Dec 11, 2006
Posts: 10
Thank you both. However this was the first time for me to recognize that I declared my outer classes with the (implicit) package access modifier that keeps the whole thing running in one file as well as the compiler refuses to accept several public (means outer) classes in one .java file.

On to these servlets...

[ October 23, 2007: Message edited by: Timo Richter ]
I agree. Here's the link:
subject: instructors solution for OOP-4
It's not a secret anymore!