Is instance variable in class, the value of reference of class or object? I am little bit confused on call by reference.
-
3Does this answer your question? [Is Java "pass-by-reference" or "pass-by-value"?](https://stackoverflow.com/questions/40480/is-java-pass-by-reference-or-pass-by-value) – papaya Mar 31 '20 at 04:28
-
Have a look [here](https://docs.oracle.com/javase/tutorial/). – akuzminykh Mar 31 '20 at 04:29
2 Answers
There seem to be two separate questions here, one regarding instance variables and another concerning passing of arguments by reference.
You can think of instance variables as "belonging" to specific instances of that class, whereas class variables are "shared" by all instances of that class.
As for pass by reference. Do keep in mind that java is always pass by value. However, variables for non-primitives (i.e. objects) store addresses to the value, as opposed to the value itself. Variables for primitives simply store the value.

- 571
- 5
- 18
Instance variable in Java is used by Objects to store their states. Variables which are defined without the STATIC keyword and are Outside any method declaration are Object-specific and are known as instance variables. They are called so because their values are instance specific and are not shared among instances.
So, instance variables are reference to objects.

- 120
- 10