• Post Reply Bookmark Topic Watch Topic
  • New Topic

Method invocation and Method call  RSS feed

 
Hector Pertierra
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone

One of those things I never learned quite correctly: What's the difference between method invocation and a call to a method. When do each one of them starts and when do they end?

Thanks
H�ctor
 
Eric Daly
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Uh... aren't they the same thing? Like what's the difference between pop and soda?
Basically it starts at the beginning and ends at the end... I'm not being sarcastic. Take an example:

In your code if you call

it goes through from the opening bracket to the closing bracket, which in this case just prints out "Hey there."

Another example:

that method starts from the beginning, but ends either at "return 1;" or "return 4;" depending on what the variable is equal to.
Does that help answer your question?

[EDIT] typo: changed "stsrts" to "starts"
[ April 13, 2007: Message edited by: Eric Daly ]
 
Hector Pertierra
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Uhmmmm... No, I think they're not. I say this because I am using AspectJ for Aspect Oriented Programming, and it defines two completely different Join Points for method invocation and method calls.

I was asked to tell one from another in a test today, and got it wrong, so I thought I'd ask. But maybe I posted it in a too basic forum. Please move it if pertinent.

Thanks
HP
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried asking whoever gave you the test, what they think the difference is ?
 
Hector Pertierra
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think it's "what they think" I think that that difference exists. And I can't ask because I have another test tomorrow and he won't answer any questions that's why I tried asking you guys

Anyway, if I don't get an answer, I'll ask my teacher after the exam and then I'll tell you.

Thanks
HP
 
Maurizio Nagni
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shortly.....
usually you define call-a-method all which have a form like
xxx.yyyy(your parameter)

on the other hand you define invoke-a-method when you still do
xxx.yyyy(your parameter)

BUT in this case
1) xxx is an interface available from a jar in your classpath
2) you created a networked connection to the real instance of xxx (that is the class which inplement the xxx interface) because it is a remote object

that is that the implementation of the method you invoke IS NOT machine but in a remote machine....to be honest it can be also your same machine.... but
if you want to know all the story about "invoking" read some documentation about RMI like
http://java.sun.com/docs/books/tutorial/rmi/index.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!