What is the difference between final and constant

Questions by saritha123

Showing Answers 1 - 4 of 4 Answers

ravikgoru

  • Jul 27th, 2006
 

Final, it can be used in 3 ways,

1. Variable declared as final, its contents cannot be changed. It value is constant through out the execution of the application

2. Method declared as final, this method cannot be overridden by methods of sub classes

3. Class declared as final, cannot be sub classed, example of final class is String.

Constant: its values cannot be changed

 

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions