InterviewSolution
| 1. |
Does Java use Pointers? |
|
Answer» No, Java doesn’t exactly use pointers. Pointers are variables which store the exact address of another variable in their memory. Due to its feature of security and robustness, Java shimmies away from this concept of pointers which forms a major PART of C and C++ in memory addressing. If we know the address of a variable, we can access and modify it from anywhere EVEN if it is private which is self-contradictory and hence Java doesn’t use pointers. INSTEAD of using a pointer, Java sticks to a safer option called references. A REFERENCE is an address that shows the location of storage of the object’s variables and methods. We never actually use objects or copies of objects when we assign objects to variables or methods. Instead we use references to those objects. References though,
|
|