| What is the difference Final Finally and Finalize
Below is the details for above three Final Finally and Finalize with some example.
Final
Final is a keyword in c# which is used to declare constant. Now some other facts about the Final keyword. When we define variables in interface that are implicitly final. And when we use Final keyword with class then it cannot be extended. And final class also may not be sub-classed. We can also use that with basic classes for security. We cannot overridden final method when its class is inherited. we cannot change value of a final variable as is a constant.
Finalize
This methods helps in garbage collection. This method is mainly used just before and object is destroyed and garbage collector.
Finally
Finally is a keyword that is used in exception handling. This is a blocks which is always executed when try blocks is there. Except the call of System.exit(0). And it is always executed whether error occurs. | | |