Answer: Constants have to be initialized during declaration only while readonly fields can be initialized at declaration or in the constructor.
Constants can be declared inside methods while readonly fields cannot be declared inside methods.
Answer: Constant variables are declared & initialized at compile time. The value can’t be changed afterwards. Read only is used wrhere the value can be changed during run time o when we want to assign the value at run time.
Not sure what course is right for you?
Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.