Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By KevinWorkman

Thread: Does Java have a pass by reference?

  1. #1
    357mag is offline Member
    Join Date
    May 2010
    Posts
    18
    Rep Power
    0

    Default Does Java have a pass by reference?

    Seems to me when I studied C++ there was a pass-by-value and a pass-by-ref. If I remember correctly, an example program that showed this stuff had the variables original value unchanged after a method call that used it, and the other one changed the value of the variable. I see a pass-by-value example program in my book but I don't see a pass-by-ref example.

    Just wondering if Java has pass-by-ref at all.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,728
    Blog Entries
    7
    Rep Power
    21

    Default Re: Does Java have a pass by reference?

    Java uses the pass by value mechanism only (just as C does).

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,013
    Rep Power
    10

    Default Re: Does Java have a pass by reference?

    DarrylBurke likes this.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Concept of Pass by Reference in Java
    By allaudin in forum New To Java
    Replies: 3
    Last Post: 05-15-2013, 06:24 PM
  2. pass by reference?
    By wayenng in forum New To Java
    Replies: 7
    Last Post: 12-24-2012, 07:36 PM
  3. How to create pass by reference??
    By --> xeiyne! in forum CLDC and MIDP
    Replies: 4
    Last Post: 04-08-2010, 07:43 PM
  4. Don't pass by reference
    By Lyven in forum Advanced Java
    Replies: 6
    Last Post: 11-16-2009, 07:06 PM
  5. Pass-by-reference
    By popjava in forum New To Java
    Replies: 1
    Last Post: 10-19-2009, 04:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •