• Post Reply Bookmark Topic Watch Topic
  • New Topic

If objects can't be passed....  RSS feed

 
Janeice DelVecchio
Bartender
Posts: 1810
12
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alright... I think I'm having another roadblock with the object/reference situation, but I'm not sure how to fix my syntax.... here's some code snippets.


and...


I also know that ArrayLists aren't IDEAL... but the use of an "ArrayList" is specifically asked for in this project.

The problem is I'm getting 2 compiler errors....
  • 1: line 28 createScore cannot be applied to Arraylist
    2: a warning about unchecked/unsafe operations in QuizGrader.


  • I think #1 has to do with me trying to send the ArrayList references to the ScoreIt class. Alright, I'm positive it does.... but what am I doing wrong??

    ... and I really thought I had it.
    --Janeice
     
    Fred Hamilton
    Ranch Hand
    Posts: 684
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I would say the object named key needs to be of the same type as the first parameter of method createScore()
     
    Janeice DelVecchio
    Bartender
    Posts: 1810
    12
    Eclipse IDE Java Windows
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Fred Hamilton wrote:I would say the object named key needs to be of the same type as the firt paramter of createScore()


    Good to see you here again, Fred.....


    Lemme try that.....

    Whoppee!! I have some other issues, but this fixes my main issue.

    Guess I was closer than I thought.
    Thanks!
    /JD/
     
    Dan Walin
    Ranch Hand
    Posts: 109
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I agree. I always need to see examples to really "get it". I just wanted to point out he importance of the deeper understanding because I have seen some coworkers who took short cuts, slapped something together that worked just fine - until problems start. Then they waste so much time not really knowing what to look for to fix the problem because they never really understood their own code.
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!