[Bluej-discuss] Book: Excercise 1.17

Josh Rountree mage at carolina.rr.com
Fri Aug 4 21:13:11 BST 2006


I copied the code you have, and pasted it into a project. It compiled after
adding two import statements at the top:

import java.util.List;
import java.util.ArrayList;

and, a Student class.



________________________________________
From: bluej-discuss-bounces at bluej.org
[mailto:bluej-discuss-bounces at bluej.org] On Behalf Of Matthew Brandt
Sent: Friday, August 04, 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;
    }
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.5/407 - Release Date: 8/3/2006

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.5/407 - Release Date: 8/3/2006
 


More information about the bluej-discuss mailing list