What are value types and references types? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

What are value types and references types?

27th Jan 2018, 4:04 AM
Rashmi
5 Answers
+ 4
Value types stores their contents in the memory allocated from stack but reference types don't have any content but they store the address of other value type content. Value type variables are stored in stack and reference type are stored in heap memory area.
27th Jan 2018, 4:23 AM
sudhir meena
sudhir meena - avatar
+ 1
value type is when we declared variables e.g int x=10 then this is a value type and it is stored in a memory location is known as Stack. Reference Type is when we create class objects e.g: class Sharp { int x; } static void Main(String[] args) { Shape s=new Shape(); //object } then data for that object is stored on heap and memory address is on the stack that is why it is known as reference type
12th Feb 2018, 1:24 PM
Vishwanath Patil
Vishwanath Patil - avatar
0
variabls value of location
30th Jan 2018, 2:41 PM
Rohit Jangid
Rohit Jangid - avatar
0
haaa
3rd Feb 2018, 4:28 PM
Rohit Jangid
Rohit Jangid - avatar
- 1
hmm
3rd Feb 2018, 4:06 PM
Rohit Jangid
Rohit Jangid - avatar