• 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
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

argument passing

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i havent got idea about the argument passing.
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Argument is nothing but providing some required information(s) for a method to process.

Consider you have a method called add(int a, int b) { return a+b; }

here a & b are the arguments. For this a and b you should provide some value for the addition to happen.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch!

Passing arguments is a way to give a method the information it needs to do what it does.

For example, suppose you have a method that factors a number. This method would take an int as an "input" argument. This int is the information the method works with -- in this case, the number it's supposed to factor. Then it might return an array of ints as the "output."

So if you wanted to factor the number 18, you could pass that value as an argument when calling the method...

factor(18);

And this would return an array containing the factors of 18...

{2, 3, 3}
[ June 29, 2006: Message edited by: marc weber ]
 
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic