Two Laptop Bag*
The moose likes Beginning Java and the fly likes If objects can't be passed.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "If objects can Watch "If objects can New topic
Author

If objects can't be passed....

Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1659
    
  11

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


    When you do things right, people won't be sure you've done anything at all.
    Fred Hamilton
    Ranch Hand

    Joined: May 13, 2009
    Posts: 679
    I would say the object named key needs to be of the same type as the first parameter of method createScore()
    Janeice DelVecchio
    Saloon Keeper

    Joined: Sep 14, 2009
    Posts: 1659
        
      11

    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

    Joined: Nov 11, 2003
    Posts: 109
    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.
     
    Consider Paul's rocket mass heater.
     
    subject: If objects can't be passed....
     
    Similar Threads
    Passed
    Passed ?
    Passed SCJP 6 with 91%!
    Passed
    Passed