Invoking methods on objects in java.

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-04-15T01:05:44Z Indexed on 2010/04/15 1:13 UTC
Read the original article Hit count: 512

Filed under:
|

If i have a class called Dice which contains this method:

public void roll () 
    {
        this.x = randNum(1, this.sum.length) ; 
        this.sum[x] ++ ;
    }

And i am in a diferent class how do i invoke this method? I am currently trying InstanceOfObjectName.Dice.roll and its not working. What should i do?

© Stack Overflow or respective owner

Related posts about java

Related posts about object-methods