• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

calling methods from main method

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tammy Kline
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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!
 
Ranch Hand
Posts: 2410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Let's get him boys! We'll make him read this tiny ad!
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic