diffrence between final and static keywords? legacy class means what? Difference between throw and throws?
June 1, 2010 at 4:43 PM
Difference between final and static keywords:
1)If you use final modifier with the variables then their values will not be change during the lifetime of the program while if you use static modifier with variable or method, then the variable or method can be accessed without creating an instance of the class.
2)A final modifier indicates that a class cannot be extended, a variable cannot be changed, and a method cannot be overridden.while if a variables is declared static,all instances share the same copy of the variable,if a method is declared static, it can be called/used without having to create an object first.
Legacy Class is related to the synchronization.You can also called it synchronization class. It is the concept of the collection framework. Examples of Legacy class are HashTable, Vector, Dictionary, Properties etc.
Difference between throw and throws:
The throw keyword is used when we want to force an exception.It can pass the custom message to the exception handling module whereas when we know that a particular exception may be thrown or pass a possible exception then we use throws keyword.