Reference variables
difference between constant and static variables in java
At any given point of time you cann't get the address of a variables of java program. This is meant for security purpose only.
No, static variables are not serialized.
yes we can define a variable in an interface in java.
Reference variables
In JAVA, all variables are reference variables, and there are no pointer variables. Even though the platform may implement them as pointers, they are not available as such. In C, no variables are reference variables. They are a C++ enhancement. In C++ a reference variable is syntactically the same as a pointer variable, except that the use of the indirection operator (*) is implicit. You do declare reference variables slightly differently than pointer variables but, once you do so, they can be treated as non-pointer variables. Reference variables also cannot be redefined once they have been initialized to point to some object. They are const. Structurally, there is no difference between a pointer variable and a reference variable. They are both still pointers. The compiler just makes it easier to treat reference variables and non-pointer variables the same way.
objects are instances of class only and moreover objects are object reference variables extension of variables is meaningless so objects in java can't be extend
No , Java does not support call by reference.
difference between constant and static variables in java
no
Global variables are globally accessible. Java does not support globally accessible variables due to following reasons:The global variables breaks the referential transparencyGlobal variables creates collisions in namespac
There's no global variables in Java.
There is no relation between reference and hascode, Java reference is unique pointer which refers an object. so each object will have a unique reference. but 2 diff object can have same hashcode.
At any given point of time you cann't get the address of a variables of java program. This is meant for security purpose only.
pass by value is the technique where a copy of the variable is passed to the method as argument. This value can be modified inside the method but that would not affect the original value. Pass by reference is the technique where the reference to the actual variable is passed to the method as argument. Any changes to this variable would affect and alter the original value. Usually primitive data types are passed by value and objects are passed by reference in java.
No, static variables are not serialized.