Computer Science, asked by sumansunil8366, 11 months ago

What is difference between constants readonly and static

Answers

Answered by riteish9797
0

1. Static variables are common across all instances of a type. constant variables are specific to each individual instance of a type but their values are known and fixed at compile time and it cannot be changed at runtime. unlike constants, static variable values can be changed at runtime.

2.The difference is that the value of a static readonly field is set at run time, so it can have a different value for different executions of the program. However, the value of a const field is set to a compile time constant. ... Constant variables are declared and initialized at compile time.

.

.hope it helps

Similar questions