Which of the following statements is true about readonly variables?
Read-only variables are class specific.
We can assign the data to the read-only variable in the constructor.
Readonly and constants both are same.
All the above.
A readonly variable is a runtime constant. We can assign the data to the readonly variable directly while declaring the variable or we can assign the data to the readonly variable in the constructor also.
Back To Top