Value Types
- Value type are the variables which are stored in its own memory location.
- Value types are stored in stack according to the order it is created.
Only c will be changed to 7.
Reference Types
- Reference types does not stored its value within its own memory location. Instead of that , it stores a pointer/address/reference where the actual value is stored.
- Reference types are stored in heap. But the variable is stored in stack and data is stored on the heap.
Both d.hp and f.hp will be changed to 100.
No comments:
Post a Comment