• Post Reply Bookmark Topic Watch Topic
  • New Topic

passing arguments  RSS feed

 
ameen ahamed
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to pass a variable by reference?
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To pass a primitive by reference, you must wrap it in an object class. All object references are passed by value, but that simply means you are passing the address anyway.
-----------------
Michael Ernest, co-author of:The Complete Java 2 Certification Study Guide
[This message has been edited by Michael Ernest (edited January 14, 2001).]
 
Abdullah Sheikh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create an array with length 1, for example int value[1];. Arrays is passing by reference also. value[0] = 123; foo(value[0]);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!