Search:

Type: Posts; User: helloworld922

Search: Search took 0.08 seconds.

  1. [SOLVED] Re: How to get the return of a method inside an object in an ArrayList?

    use the instanceof operator:

    if(dealersHand.get(i) instanceof Card)
    {
    // guaranteed to be safe to cast to Card
    }
  2. [SOLVED] Re: How to get the return of a method inside an object in an ArrayList?

    You're running into that problem because you're not specializing your ArrayList. Casting it to a Card will work, but it's not a good solution since it's possible that dealersHand could contain...
  3. [SOLVED] Re: How to get the return of a method inside an object in an ArrayList?

    What exception are you getting (please post the message you're gettting)? Your description looks like it should work, though I can see one potential problem when it comes to generic typing.
Results 1 to 3 of 3