Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 804405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:54:51+00:00 2026-05-14T23:54:51+00:00

In java, when you pass an object to a method as a parameter, it

  • 0

In java, when you pass an object to a method as a parameter, it is actually passing a reference, or a pointer, to that object because objects in Java are references.

Inside the function, it has a pointer to that object which is a location in memory. I am wondering where this pointer lives in memory? Is a new memory location created once inside the function to hold this reference?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T23:54:51+00:00Added an answer on May 14, 2026 at 11:54 pm

    Within a function, a parameter reference is stored on the stack. The thing-referenced can live anywhere.

    When some code calls a method, what normally happens is that space is made on the executing thread’s stack, and this space is used to hold the parameters that are passed to the function. If one of the parameters “is an object”, what’s really in play is a reference to an object; that reference is copied onto the stack so that the called code can find it. It’s important to recognize that the object itself is not copied, just the reference.

    The prologue section of the called code will then typically allocate more space on the stack, for the method’s own local variables, but underneath, the JVM has a pointer to the stack frame with all the parameters, so the called code can locate the object named by the parameter. Items created with ‘new’ will be allocated from the heap, and can persist even after the method exits, but all items allocated on the stack are dumped simply by moving the stack pointer back to where it was before the call.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 509k
  • Answers 509k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I always find some examples on Internet that the guy… May 16, 2026 at 4:46 pm
  • Editorial Team
    Editorial Team added an answer At least for BufferedInputStream, the answer is definitely no. It… May 16, 2026 at 4:46 pm
  • Editorial Team
    Editorial Team added an answer RSpec has some serious conflicts between Rails3 beta, and RSpec… May 16, 2026 at 4:46 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I've tried to create a web method which has parameter of java.lang.Object but I
I am trying to wrap my mind around something in java. When I pass
I read this excellent article and it make sense: Java is strictly pass by
public void wahey(List<Object> list) {} wahey(new LinkedList<Number>()); The call to the method will not
Suppose I've got a method that accepts an array and processes each element in
I have two Java class hierarchies that share a common ancestor and implement a
Here is a problem I've struggled with ever since I first started learning object-oriented
We have a place in a code of such form: void processParam(Object param) {
What I'm looking for is to have an f:param tag with an Object of
I have a simple question (working with Java). I have two classes, one represents

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.