|
-
Nov 23rd, 2001, 07:30 AM
#1
Thread Starter
Hyperactive Member
Does Java call by reference or by value?[resolved]
I always thought that Java called things by reference because it calls the address and not the value itself, but according to my lecturer it always calls by value, which seems a bit strange to me. Just wondered if someone could explain how it is that Java always calls by value
Last edited by Pix; Nov 23rd, 2001 at 10:26 AM.
-
Nov 23rd, 2001, 08:27 AM
#2
PowerPoster
I think Java passes its primitive data types such as int, char, double, etc. by value whilst it passes arrays and objects by reference. Strings can be considered as byval since a String cannot have its value updated, with the new value returned.
But I'm no Java expert...
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
-
Nov 23rd, 2001, 09:32 AM
#3
Member
But you're exactly right.
-
Nov 23rd, 2001, 10:11 AM
#4
PowerPoster
Cool as!
Shows I have some uses then. That's the only post I've felt competent enough to make in here - I didn't know if I was talking complete bollocks or not, but I'd thought I'd take the risk to help Pix out....
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
-
Nov 23rd, 2001, 10:26 AM
#5
Thread Starter
Hyperactive Member
Thank you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|