- When the variable are declare under the class, by default every variable having a default value which will be zero for integer type ,False for Boolean types, Null for string and object type. Where as if a variable is declared under any block of code it is must to initialized those variable at the time of declaration.
- The default scope for the member of class is private.
- A constant variable cannot be modified once after its declaration so it is must to assign value at the time of its declaration.
- A readonly variable can not be modified once after its initialization so at the time of declaration it is not mandatory to assign a value, it can be initialized after the declaration also.
- Decimal value are by default treated as double so we need to use as f-suffix to treated as a float and m-suffix to the value to treat as decimal.
Example To get the data Type Of a variable
Note:- "GetType" is a predefined method that returns the type of given variable or Instance.
No comments:
Post a Comment