aspose file tools*
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
Author

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......



......is 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

Steve


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

Joined: Oct 29, 2001
Posts: 8968
    
    9



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)

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: A simple(!) "Call by Value "Example