Parameter passing

I'm sorry to do this but the examples I have seen are confusing to me. What is the difference between call by name parameter passing, and call by value? It would be great if someone could give me a Java example and explain to me how it would be different if call by name was used instead?

Thanks a lot in advance.

[327 byte] By [abu5ea] at [2007-11-27 5:19:08]
# 1
do you mean pass by reference or by value?java is all pass by value. google or forum search for more info.
TuringPesta at 2007-7-12 10:42:27 > top of Java-index,Java Essentials,Java Programming...
# 2

Sorry yeah there's another way to refer to it - pass instead of call. I know java always uses pass-by-value (and uses pass-by-reference-value to allow objects to be manipulated in a similar way to reference passing.) I understand all of the above, I just don't understand what pass-by-name is. I have search Google and read several definitions, I also have a book in front of me but I just can't seem to grasp pass-by-name parameter passing.

abu5ea at 2007-7-12 10:42:27 > top of Java-index,Java Essentials,Java Programming...
# 3
ive never heard of pass by name, so it doesnt exist.
mkoryaka at 2007-7-12 10:42:27 > top of Java-index,Java Essentials,Java Programming...
# 4
I like your confidence :) it does exist though, call by name or pass by name - I hate the way all of these have two ways of referring to them.
abu5ea at 2007-7-12 10:42:27 > top of Java-index,Java Essentials,Java Programming...
# 5

> I know java always uses pass-by-value (and uses pass-by-reference-value to

> allow objects to be manipulated in a similar way to reference passing.)

"Pass-by-reference-value"? Never heard of it. Java has only one parameter passing semantics: pass by value. That might have been what you were trying to say, but using terms like "pass by <fill in with whatever you want>" encourages make believe.

"Call by name" has an entry in Wikipedia here: http://en.wikipedia.org/wiki/Call_by_name#Call_by_name According to that entry, "the arguments to functions are not evaluated at all — rather, function arguments are substituted directly into the function body"

Wikipedia gives a couple of examples (both from ALGOL 60). No Java example is possible.

pbrockway2a at 2007-7-12 10:42:27 > top of Java-index,Java Essentials,Java Programming...