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

  • SEARCH
  • Home
  • 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 8484523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:24:15+00:00 2026-06-10T20:24:15+00:00

My question or rather questions are as follows: 1)Where does the static variable reside

  • 0

My question or rather questions are as follows:

1)Where does the static variable reside . Some articles say they reside on the heap and some some say in the perm gen area with the class definition as they are class attributes. I understand the second option might be correct because it is a class attribute.
2)Where does the final variable reside and what is its life if:
a) Its an instance variable of type primitive
b) Its a local variable of a method of type primitive
c) Its an instance variable of type reference
b) Its a local variable of a method of type reference
3)Where are the reference local variables stored if they are local.
4)In case of arrays is there any difference in memory allocation as in they are instance variable or local thread variable.

Thanks

  • 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-06-10T20:24:16+00:00Added an answer on June 10, 2026 at 8:24 pm

    Where does the static variable reside

    – static variable resides in Method Area, and permgen is inside Method area.

    Where does the final variable reside and what is its life if
    Its an instance variable of type primitive
    

    – If its instance variable, it stays on the Heap inside the Object to which it belongs, and falls out of scope as there is no reference to the Object which holds it..

    Its a local variable of a method of type primitive

    – It stays on the Stack, and and falls out of scope as there as the methods closing brace is reached…

    Its an instance variable of type reference

    – it stays on the Heap inside the Object to which it belongs, and falls out of scope as there is no reference to the Object which holds it..

    Its a local variable of a method of type reference

    – It stays on the Stack, and and falls out of scope as there as the methods closing brace is reached…

    Where are the reference local variables stored if they are local.

    – On the Stack…

    In case of arrays is there any difference in memory allocation as in they are instance variable or local thread variable.

    – Well as Array is an object it is stored on Heap….but from Java 6u23 version, there has been the introduction of Escape Analysis, according to this if the JVM decides that the Object canNot escape the Method, it will try creating the Object on the Thread’s Stack , NOT ON HEAP….

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

Sidebar

Related Questions

Have a rather simple question. Does anyone knows if i can use jparallax both
Excuse if this is more a file format conversion question rather than programming, but
Rather Trivial Question. So I tried to do this: if (array[0]==some_string) where array is
My question is rather subjective, moderators please do not close it, for I want
The question is rather straightforward but not answered by searching. How do I determine
The question is rather of academic nature... I've got the following architecture: Apache server
My question is rather simple. Let's suppose I'm executing the algorithm A star (search
my question is rather simple, if you have an pure virtual class (interface) but
I think its a rather simple question but I couldn't really find an answer
This is a rather vague question but here we go - I would like

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.