Computer Science Canada

calling static methods

Author:  Master [ Wed Mar 03, 2004 12:00 am ]
Post subject:  calling static methods

How do you call a method like this. What parameter do you use when you call drawH(?, ?)
mine doenst work, no matter what i put.

public static void drawH(Graphics2D g2, Point2D.Double p)

Author:  wtd [ Wed Mar 03, 2004 12:30 am ]
Post subject: 

Exactly what error are you getting?

In Java a static method is called like so:

code:

ClassTheMethodIsIn.method(params)


Rather than:

code:

object.method(params)

Author:  Master [ Wed Mar 03, 2004 12:32 am ]
Post subject: 

ya i know

what parameter do you need for this calling of a static method

drawH(_, _)<-- what is an example of the parameters needed
public static void drawH(Graphics2D g2, Point2D.Double p)

Author:  wtd [ Wed Mar 03, 2004 12:51 am ]
Post subject: 

Well, you'd need an object of class Graphics2D and one of Point2D.Double. Go look them up at http://java.sun.com to find out which constructors those classes have.

Author:  Master [ Wed Mar 03, 2004 12:53 am ]
Post subject: 

thanks


: