Explain difference between final, finally and finalize?
Answer Posted / ranganathkini
When a class is marked final, it cannot be subclassed. When
a method is marked final, it cannot be overridden by the
subclass. And when a field is marked final, its value once
set, cannot be reset.
finally is the last clause in a try...catch block. It is a
block of statements that is executed irrespective if or if
not an exception was caught in the preceding try block.
finalize is a reserved method in Java, which can be
overridden by classes containing code to release any
expensive resources being held to by the object. Expensive
resources include, native peer objects, file/device/database
connections.
Is This Answer Correct ? | 64 Yes | 13 No |
Post New Answer View All Answers
can any body body expalin best definitions & best real time exaples for opps concepts.
What happens if a constructor is declared private?
I want my class to be developed in such a way that no other class (even derived class) can create its objects. Define how can I do so?
What is meant by attribute?
How do you use spaces in java?
What is the independent variable in an experiment?
What is the main difference between java platform and other platforms?
What is the use of predicate in java 8?
Is array passed by reference in java?
What is a bufferedreader?
Can we use String with switch case?
What is a boolean structure?
Is there any way to find whether software installed in the
system is registered by just providing the .exe file?
I have tried the following code but its just displaying the
directory structure in the registry.
Here the code :
package com.msi.intaller;
import java.util.Iterator;
import ca.beq.util.win32.registry.RegistryKey;
import ca.beq.util.win32.registry.RootKey;
public class RegistryFinder {
public static void main(String... args) throws Exception
{
RegistryKey.initialize(RegistryFinder.class.getResource("jRe
gistryKey.dll").getFile());
RegistryKey key = new RegistryKey(RootKey.HKLM,
"Software\\ODBC");
for (Iterator
What is a class reference?
what is the significance of listiterator in java?