• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

HeadFirst >>Chapter14:ArrayList Error

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

I am copying the program from Chapter 14 from HeadFirstJava;QuizCardBuilder.java. 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());
cardList.add(card);

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

[edit - added code tags]
[ August 02, 2007: Message edited by: Fred Rosenberger ]
 
lowercase baba
Posts: 13073
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
divya sharma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I am using 5.0 version. I am using eclipse to complie the code .. I am unable to compile the code

Thanks
Divya
 
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Posting the error message might be helpful.
 
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,



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 ]
 
Get meta with me! What pursues us is our own obsessions! But not this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic