File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes A simple(!)  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "A simple(!)  "Call by Value "Example" Watch "A simple(!)  "Call by Value "Example" New topic

A simple(!) "Call by Value "Example

Steve Jensen
Ranch Hand

Joined: Sep 23, 2002
Posts: 126
Hiya folks.

OK, now i understand conceptually, what passing an argument by the "Call by Value" principle is.

But i've been looking at a small program from a book, which is meant to illustrate it. The code is below:-

I sort of understand how this program works, but i am well and truly stumped as to what the line...... doing.

What on earth is 'meth', i.e., this hasn't been declared anywhere else in the code!

Why is this so?

Any help would be greatly appreciated.

Cheers in advance


John Bonham was stronger, but Keith Moon was faster.
Joe Ess

Joined: Oct 29, 2001
Posts: 9188

ob is an instance of class Test. Find where Test is declared and you should find a method named meth.

[How To Ask Questions On JavaRanch]
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
You're missing the class Test (meth must be a method of this class)

If I'm reading what it's supposed to depict correctly, here's what would
go with it (and a bit extra, to see the difference)

I agree. Here's the link:
subject: A simple(!) "Call by Value "Example
jQuery in Action, 3rd edition