This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes HeadFirst >>Chapter14:ArrayList Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "HeadFirst >>Chapter14:ArrayList Error" Watch "HeadFirst >>Chapter14:ArrayList Error" New topic

HeadFirst >>Chapter14:ArrayList Error

divya sharma
Ranch Hand

Joined: Jan 25, 2007
Posts: 87
Hi ,

I am copying the program from Chapter 14 from HeadFirstJava; But there is an error when I am writting program on ArryaList.

Here is a program :

Following lines where I found Error:
1) private ArrayList<QuizCard> cardList;
2) cardList = new ArrayList<QuizCard>;
3) QuizCard card = new QuizCard(question.getText(),answer.getText());

Please help me to find out error. where I went wrong.

[edit - added code tags]
[ August 02, 2007: Message edited by: Fred Rosenberger ]

fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11175

I added code tags to your post to make it easier to read. Please use them yourself in the future when you post source code.

Now, what exactly is the error you are getting, and what version of Java are you using? I'm guessing it may be because you have 1.4, and this code uses features introduced in 1.5, but without those error messages, it's just a stab in the dark.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
divya sharma
Ranch Hand

Joined: Jan 25, 2007
Posts: 87
Well I am using 5.0 version. I am using eclipse to complie the code .. I am unable to compile the code

David McCombs
Ranch Hand

Joined: Oct 17, 2006
Posts: 212
Posting the error message might be helpful.

"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration."- Stan Kelly-Bootle
subodh gupta
Ranch Hand

Joined: Jul 23, 2007
Posts: 203

error is mentioned above do it like this:

if problem still persists please give me QuizCard class.
[ August 03, 2007: Message edited by: subodh gupta ]
I agree. Here's the link:
subject: HeadFirst >>Chapter14:ArrayList Error
Similar Threads
New Quiz Card Builder/Player for Exam Study
QuizCard class not found. (Head First Java 2nd Ed)
Head First Java QuizCardBuilder not saving files correctly
Runtime Error in Program for Unknown Reasons
Problem reading JTextArea