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.
The moose likes Beginning Java and the fly likes subroutines,methods beginner explanation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "subroutines,methods beginner explanation" Watch "subroutines,methods beginner explanation" New topic
Author

subroutines,methods beginner explanation

cornel jew
Ranch Hand

Joined: Jul 13, 2002
Posts: 37
Hi folks
I am fairly new to programming and i just want to know in a simple explanation how methods are working.Especially whe you put an object in a method.
I have read some books but the explanations they give is like if you know programming.
my eg. public void myMethod(MyObject){}
if its the right way of trying to put it.
What is going on and how is it executed.
Please help me with examples.
Greg Brouelette
Ranch Hand

Joined: Jan 23, 2002
Posts: 144
I think the problem here is that in order to give you a "simple" explaination we have to make assumptions about what you already know or understand. That makes this question more complex than you may realize.
Before I give a simple example I would point you to http://www.bruceeckel.com/ to get Bruce's book "Thinking In Java". I'm having trouble getting to that site right now so I'll also point you to http://www.codeguru.com/java/tij/ You can download the entire book and it's source code for free from either site. This is an excellent book that will take you through the steps to get you where you want to be.
Now, how to pass something in to and out of a method. Let's tell the story in source code.


For a good Prime, call:<br />29819592777931214269172453467810429868925511217482600306406141434158089
 
GeeCON Prague 2014
 
subject: subroutines,methods beginner explanation