This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Ok so basically i have to call the returnRatio method in my main class...and I have no idea how to call it because im not creating an object and then calling the method on the object. here is my code of the method...
EDIT by mw: Added Code Tags to original poster's indentation.
[ February 11, 2007: Message edited by: marc weber ] [ February 11, 2007: Message edited by: Bear Bibeault ]
what would the syntax be tho? i have 2 classes...1 called ratio which holds the code above, and the other is called ratioTester which holds the public static void method...what would i put in ratioTester?
Ernest has pretty much laid out the answer for you. You're asking for the actual syntax without showing that you have at least tried. You'll find that if you show some effort, people around here will be more willing to assist you.
Now Ernest said that in the main method (which will be in your RatioTester class) you need to create an instance of the Ratio class and then you will be able to call your method.
So you need to know three basic things here: 1) how do you create an object from a class (hint you need a java key word) 2) how to assign a reference to that object, and 3) how to call a method on the object.
These are all basic things that can be found in any beginner's Java text, or alternatively you can search for on the Web or on this site. There is plenty of material out there.
Joined: Feb 07, 2007
ok so I tried that and it wasnt working last night so thats why I asked the "stupid" question lol...but i realized i forgot the public static void main (String args) statement...thanks for your help guys