Welcome to the CSC Q&A, where you can get help (and share your knowledge) about computer science!

Static method from another class

+15 votes
How do you call a static method from another class?
asked Jan 18, 2016 in (Winter 15-16) by Michael McAleer (100 points)

1 Answer

+4 votes
Best answer
You've already done this with:  Math.sqrt(...)

You're probably talking about doing it with a static method in another class that YOU wrote, rather than the built-in Math class though.  However, it works just the same...

<Class Name>.methodName(...)

e.g. ArtMaker.makeArt(...)

Just make sure to provide all of the correct parameters in the correct order, when you call it.
answered Jan 18, 2016 by Forrest Stonedahl (100 points)
selected Jan 18, 2016 by Michael McAleer
Thanks. I got it to work