my dog learned polymorphism*
The moose likes Beginning Java and the fly likes calling methods from main method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "calling methods from main method" Watch "calling methods from main method" New topic
Author

calling methods from main method

Tammy Kline
Greenhorn

Joined: Apr 07, 2007
Posts: 20
Ok, say I have 3 methods:



How do I call methods "metOne" and "metTwo" from the main method?? All of the information I can find on it is just confusing me even more.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

As both methods are static, you can just call them, and get the returned value


Note the "For (int x = 0; x > 5; x--)" is not going to lead you anywhere


[My Blog]
All roads lead to JavaRanch
Tammy Kline
Greenhorn

Joined: Apr 07, 2007
Posts: 20
Originally posted by Satou kurinosuke:
[QB]As both methods are static, you can just call them, and get the returned value



I just tried plugging that into my real code and it gave me an error saying . <sigh> this is absolutely frustrating. Thanks anyway!
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
You aren't showing us the code so we don't know where it is.

But that message tells you that you are trying to call a method that expects an int parameter and aren't sending any.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

http://faq.javaranch.com/view?AvoidRedHerrings

<sigh> this is absolutely frustrating

That would be less frustrating if you'd show us the real problem. Your first post shows a methods with no parameters, whereas your compile error indicates that you are trying to call a method you has a parameter. It will be difficult to help if you don't post your real problem.
[ April 22, 2007: Message edited by: Satou kurinosuke ]
Tammy Kline
Greenhorn

Joined: Apr 07, 2007
Posts: 20
Originally posted by Satou kurinosuke:
http://faq.javaranch.com/view?AvoidRedHerrings


Sorry ... I knew it was a big no-no to repost something already posted but in my ... tiredness, frustration, add whatever word you like here ... to figure this out, I posted a new question instead of adding to my already posted question which would've made more sense.

I'll consider my hand slapped and make sure not to do this again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: calling methods from main method
 
Similar Threads
thread
Daught
Static initializer order
Static????????????
problem...help me ..pls.