public Card getCard(int position)
    {
        /**
         * Gets the card from the specified position in the hand.
         * Null is returned if the position isn't in the hand.
         */
        if(position>=0 && position < hand.size())
        return (Card)hand.removeElementAt(position);
        else
        return null;
    }

error message: return (Card)hand.removeElementAt(position); is highlighted, "inconvertible types"

Recommended Answers

All 4 Replies

oh, sorry.
why does it say that?

First of all, the javadoc goes outside the method.

Second I believe that you get the error when you run it?
If it is true, then I think the 'hand' Vector doesn't have inside it objects of type Card. What do you put inside the 'hand' ?

/**
         * Gets the card from the specified position in the hand.
         * Null is returned if the position isn't in the hand.
         */
public Card getCard(int position)
    {
        if(position>=0 && position < hand.size())
        return (Card)hand.removeElementAt(position);
        else
        return null;
    }

This should help you understand how Javadoc comments should be written.

This should help you understand how Javadoc comments should be written.

nyeah, but I doubt he's actually trying to write javadoc-comments, otherwise he would mention his params, return and possible exceptions :)

my bet is on javaAddict's solution, go and check what you put in there. it's like the magician who accidently put a piglet in his top-hat. the chances of him pulling out a rabbit are quit slim

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.