Search Interview Questions
| More than 3000 questions in repository.|
There are more than 900 unanswered questions.
Click here and help us by providing the answer.
Have a video suggestion.
Click Correct / Improve and please let us know.
|Java - Interview Questions and Answers|
|Very frequently asked. Favorite question in Walk in Drive of many Indian service companies. Frequently asked in HCL Technologies, TCS and Accenture.|
|Ans. final - constant variable, objects cannot be de-referenced, restricting method overriding, restricting class sub classing.|
finally - handles exception. The finally block is optional and provides a mechanism to clean up regardless of what happens within the try block. Use the finally block to close files or to release other system resources like database connections, statements etc.
finalize() - method helps in garbage collection. A method that is invoked before an object is discarded by the garbage collector, allowing it to clean up its state.
Sample Code for final
Sample Code for finally
Sample Code for finalize
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve  java   oops   final   finally   finalize Asked in 61 Companies basic   frequent|
Try 4 Question(s) Test
| Which of the following combination of keywords is illegal in Java ? |
a. static and transient
b. transient and final
c. static and synchronized
d. abstract and final
|Difference between final and effectively final ? Why is effectively final even required ?|
| Which keyword is used to provide explicit access of a code block to single thread ? |
|What is a final method ?|
|Enums cannot be declared ..|
|What is a Final Variable ?|
|Can we override compareTo method for Enumerations ?|
|enums are intrinsically ..|
|When we say final x = 10, is the reference final or the value ?|