• Post Reply Bookmark Topic Watch Topic
  • New Topic

Object as an argument  RSS feed

 
jignesh soni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If some method is taking object as an argument, how can we pass object as argument ?
for example
public void parseInteger(int d){
int k = d * 20;
System.out.println(k);
}

now,
public void parseObject(Animal a){
a.roam();
}

So, what do we pass as argument.
Because in case of primitives, its clear what to pass and how to pass.
But what about objects ?

Thanks in advance for your replies.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jignesh soni:
...in case of primitives, its clear what to pass and how to pass.
But what about objects ? ...

I think this will help explain it: JavaRanch Campfire Story: Pass By Value.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!