This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

subroutines,methods beginner explanation

 
cornel jew
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic