Core java - Interview Questions and Answers for 'Disney' - 2 question(s) found - Order By Newest Very frequently asked. Favorite question in Walk in Drive of many Indian service companies. Frequently asked in HCL Technologies, TCS and Accenture. Q1. What is the difference between final, finally and finalize() ? Core Java
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   final vs finally vs finalize Asked in 61 Companies basic   frequent Try 4 Question(s) TestRelated Questions Difference between final and effectively final ? Why is effectively final even required ? 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 What is a final method ? Which keyword is used to provide explicit access of a code block to single thread ?
a. Transient
b. Final
c. Explicit
d. Synchronized Enums cannot be declared .. What is a Final Variable ? Should we override finalize method ? Can we override compareTo method for Enumerations ? enums are intrinsically .. Very Frequently asked to fresh graduates and less experienced. Favorite question in Walk in drives. Frequently asked in Indian Services companies. Q2. Difference between Overloading and Overriding ? Core Java
Ans. Overloading - Similar Signature but different definition , like function overloading.
Overriding - Overriding the Definition of base class in the derived class. Sample Code for overloading Sample Code for overriding Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   oops   overloading   overriding   oops concepts   basic interview question   overloading vs overriding Asked in 86 Companies basic   frequent Try 1 Question(s) TestRelated Questions What are the difference between composition and inheritance in Java? Explain OOPs
or
Explain OOPs Principles
or
Explain OOPs Concepts
or
Explain OOPs features
or
Tell me something about OOPs What is the difference between Encapsulation and Abstraction? What are points to consider in terms of access modifier when we are overriding any method? What is Polymorphism in Java ? Can you give a real world example of Encapsulation and Abstraction ? Why every object constructor automatically call super() in Object before its own constructors? How compiler handles the exceptions in overriding ? Difference between Composition and Inheritance ?