[Bluej-discuss] Book: Excercise 1.17

Bruce Barton bartonb at sunysuffolk.edu
Fri Aug 4 21:21:57 BST 2006


Matt,
 
Are you running Java Version 5.0 or the older 1.4.x version.
The older version does not recognize generics and will cause that error message.
 
Bruce Barton
Suffolk County Community College

________________________________

From: bluej-discuss-bounces at bluej.org on behalf of Matthew Brandt
Sent: Fri 8/4/2006 3:56 PM
To: bluej-discuss at bluej.org
Subject: [Bluej-discuss] Book: Excercise 1.17


List,

I hope that this isn't a frivolous question that has been answered in the past or is due to a mistake on my part. I am trying to run the exercise 1.17 listed in the most recent edition of the "Objects First with Java: A Practical Introduction Using BlueJ." When I try to compile the Student class I receive the error: <identifier> expected 

What am I missing here?

Cheers,
Matt

Specifically the compiler hangs up on (see arrow):


public class LabClass
{
    private String instructor;
    private String room;
    private String timeAndDay; 
-->private List<Student> students;
    private int capacity;
    
    /**
     * Create a LabClass with a maximum number of enrolments. All other details 
     * are set to default values.
     */
    public LabClass(int maxNumberOfStudents)
    {
        instructor = "unknown";
        room = "unknown";
        timeAndDay = "unknown"; 
        students = new ArrayList<Student>();
        capacity = maxNumberOfStudents;
    }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 4949 bytes
Desc: not available
Url : http://lists.bluej.org/pipermail/bluej-discuss/attachments/20060804/8bc3a6c8/attachment.bin


More information about the bluej-discuss mailing list