This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes pass by reference problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "pass by reference problem?" Watch "pass by reference problem?" New topic
Author

pass by reference problem?

harsh garg
Ranch Hand

Joined: Jul 13, 2008
Posts: 33
in pass by reference we generally pass class name and it's object,like this way can we pass interface and it's object?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

harsh garg wrote:in pass by reference we generally pass class name and it's object,like this way can we pass interface and it's object?


you can declare interface reference as a parameter . and you can pass a object which implements the interface . and also you cant instantiate an interface

rakesh kumar nampally
Ranch Hand

Joined: Feb 03, 2007
Posts: 46
Hi,

You can declare Interface and its reference in parameter list as , to this method you can send the object references which implement this Interface.

Thanks,
Rakesh.


thanks & regards, Rakesh
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38045
    
  22
If you pass by reference you aren't writing Java. Java works entirely on a pass-by-value basis. We have an FAQ about that. You can also do a search on this forum and you find all sorts of useful things about it, including my post in this thread, which has some useful links to other threads or resoures.
 
Consider Paul's rocket mass heater.
 
subject: pass by reference problem?
 
Similar Threads
confusion in pass by reference
class instance variables modifying
Question based on pass by reference
Integer : pass by value ?
GC (enthuware question)