What are Value types and Reference types?
Memory allocates within a compile time and it will use a stack memory. Stack is faster in access. Stack is under the control of os, so garbage collector can’t interact with this.
Stack is used to store small amount of data.
Reference type: memory allocates in run time and it will uses heap memory. DE allocation of the memory will be take care by garbage collector.
Garbage collector will destroy unused object in memory.
String & Object types comes under Reference Type.
========================================================
What is Implicitly Typed Variable?
This is a new feature, which allows you to declare a variable using the keyword var.
Ex: var x=100-> x is integer
Var s=”Hello”->s is string.
What are Null able Value Types?
To store Null Values we can store null values in value types also
Example:
String str =null ->valid
In value type:
int x=null à invalid
No comments:
Post a Comment
Thank you for visiting my blog