[Bluej-discuss] Book: Excercise 1.17

Matthew Brandt mattchief at gmail.com
Mon Aug 7 18:37:05 BST 2006


Davin & Bryan (and others on the BlueJ-list that tried to help me trouble
shoot);

Many thanks for pointing me in the correct direction. Ultimately the answer
to my dilemma was selecting (within BlueJ) the correct version of Java to
use. A simple setting to change, but something that I had overlooked none
the less.
Thanks again,I look forward to exploring Objects First with Java: A
Practical Introduction using BlueJ.

Best wishes,
Matt Brandt

On 8/7/06, Bryan J. Higgs <bhiggs at rivier.edu> wrote:
>
>  As Davin McCall suggested, perhaps you haven't specified that BlueJ use
> the Java JDK 1.5 (aka 5)?
> You'll have problems trying to compile anything with what are called
> 'generics' (those things that look like List<Student> ) unless you use 1.5or higher.
>
> Good luck!
>
> Bryan
>
>
> Matthew Brandt wrote:
>
> Bryan,
> Thanks! I had made the mistake of declaring my Student class as Private.
> Simply switching it to Public remedied my predictament. Thank you for taking
> the time to help me debug. I've just started using the "Objects First with
> Java: A Practical Introduction using BlueJ," by David J. Barnes & Michael
> Kölling. Some of the examples early examples (chapter 1 &2) from the book
> (the downloadable book projects <http://www.bluej.org/objects-first/>)
> aren't compiling as easily as I suspect they should.
>
> Cheers,
> Matt
>
> On 8/5/06, Bryan J. Higgs < bhiggs at rivier.edu> wrote:
> >
> >  Matthew --
> >
> > The line:
> >
> > private List<Student> students;
> >
> > says that you are declaring a field in your LabClass called 'students',
> > which is of type 'List of Students'.
> > A List is one type of 'container' class, which can contain zero or more
> > objects.
> > A List of Students may only contain objects of type Student (which must
> > be the name of a class).
> > If you don't have a class called Student in your program, then your
> > program won't compile, because the compiler won't know what 'Student' means.
> >
> > You could write a simple student class something like:
> >
> > public class Student
> > {
> >     private String name;
> >
> >     public Student(String nm)
> >     {
> >         name = nm;
> >     }
> >
> >     public String getName()
> >     {
> >         return name;
> >     }
> > }
> >
> > I hope that helps
> >
> > Bryan
> >
> > Matthew Brandt wrote:
> > Bruce, thank you for the input, I just updated to the most recent Java
> > Version, I was running 1.4.x. Unfortunately that wasn't the fix. As for
> > what Josh recommended, I'm afraid to say that I'm a bit confused. What is
> > the last line of code that I need to add?
> >
> > import java.util.List;
> > import java.util.ArrayList;
> >
> > and, a Student class. - What do you mean by this?
> >
> > matt
> >
> > ------------------- previous message-----------------------
> > From Excercise 1.17 (lab-classes), http://bluej.org/download/download.html
> >
> >
> > >>public class LabClass
> > >>{
> >     >>private String instructor;
> >     >>private String room;
> >     >>private String timeAndDay;
> >     >> private List<Student> students;
> >     >>private int capacity;
> >
> > ------------------------------
> >
> > _______________________________________________
> > mailing list bluej-discuss at bluej.org
> > To unsubscribe or change your preferences, go tohttp://lists.bluej.org/mailman/listinfo/bluej-discuss
> >
> >
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.bluej.org/pipermail/bluej-discuss/attachments/20060807/d235009a/attachment-0001.html


More information about the bluej-discuss mailing list