Question: Finalize method in Java



Share on Google+Share on Google+

Deepak Kumar
Finalize method in Java
1 Answer(s)      6 years and 7 months ago
Posted in : Java Beginners

What is the use of Finalize method in Java? Give me few example of Finalize method.

View Answers

October 6, 2010 at 5:49 PM

Hi Friend,

Java uses finalize() method for Garbage collection.


public class FinalizeObject extends FileOutputStream {

// Contructor definition of the FinalizeFileOutputStream class.
public FinalizeFileOutputStream() throws IOException{
super("Rose India"); // call the super class constructor.

public static void main(String[] args) throws IOException {

// Create object of FinalizeFileOutputStream class.
FinalizeFileOutputStream objOutstream = new FinalizeFileOutputStream();

// finalize() method call.
System.out.print("Stream is closed successfully and connection has "+
"cleaned up to the file.");




Related Tutorials/Questions & Answers:
Finalize method - Java Beginners
method, please can you suggest me a way out.   Hi method, finalize : Every class inherits the finalize() method from java.lang.Object the method... to the object exist the Object finalize method performs no actions but it may
Finalize method in Java - Java Beginners
Finalize method in Java  Hi, What is the use of Finalize method in Java? Give me few example of Finalize method. Thanks   Hi Friend, Java uses finalize() method for Garbage collection. Example: import
finalize() method
finalize() method  Can an object's finalize() method be invoked while it is reachable?  An object?s finalize() method cannot be invoked... finalize() method may be invoked by other objects
Finalize Method in Java
Finalize method in Java is a special method called by the garbage collector... unreachable. Example of Finalize method in Java: package Toturial; class... finalize() method before the memory is reclaimed. The finalize method will return
Java finalize() Method Example
Java finalize() Method Example In this section we will read about the finalize() method. We will read how the finalize() method may used in the programming, why finalize() method is declared as protected and many more things
java method
java method  can we declare a method in java like this static { System.loadLibrary("nativelib"); } i have seen this in a java learning E book. i don't understand the static { } plz help me. what kind of method
pass method reference in java
pass method reference in java  How to pass method reference in Java
java method - Java Beginners
java method  Plz help me on toString() in java  Hi Friend, The Object class provides the method toString() that returns the string..., the toString() method of the object is automatically called. Thanks
java method - Java Beginners
java method  i wanna explation about a method for example... Mail[] getAllMails(String userName) I WANNA EXPLATION ABOUT ABOVE METHOD CAN U... and Tutorials on Java Mail visit to : Thanks
class method in java
class method in java  How to write a class method in Java?   You must read Java - Class, Object and Methods in Java
Using throw in java method
Using throw in java method  using throw with method implies what
try catch method in java
try catch method in java  try catch method in java - when and how should i use the try and catch method in Java ?   Please visit the following links: http
Java making a method deprecated
Java making a method deprecated  java making a method deprecated In Java how to declare a method depricated? Is it correct to use depricated... or method in Java. Instead of it you can use alternatives that exists. Syntax
Generic Method - Java Beginners
Generic Method  I want simple java program for Generic Method with explanation
Static Method in Java
Static Method in Java  Is Overriding Static methods possible in java? If Yes, How
getch() method in java
getch() method in java  does someone know how can i obtain the getch() function in java
java method - Java Beginners
java method  hi friends, Is there any default return type for methods in java?  There is no default return type in java, as a user you have to specify the return type even void
Class and method question, Java?
Class and method question, Java?  Consider a Java class that you... Prompt string** and the following method: getValue displays the prompt and reads..., the method should display an error message and ask the user for a new value
getch() method in java
getch() method in java  does someone know how can i obtain the getch() function in java?   Hi Friend, In java, you can use the method next() of Scanner class. Here is an example: import java.util.*; class Hello
Object Class Methods in Java
(), wait(), etc Java object class methods are:- finalize() clone() equals...() Method:- finalize() method of java.lang.Object class may be overridden.... The finalize method is called before garbage collected, the runtime system call its
Method overloading in java program
Method overloading in java program  How can we use method overloading in java program?   Method overloading:?In method overloading methods have same name but different type of parameters. Here is an example of method
Method decleration in java
Method decleration in java  What is the catch or declare rule for method declarations
method overloading - Java Beginners
method overloading   Write a program to demonstrate the method... }  Hi Friend, In Java, the methods having the same name within... is referred to as Method Overloading. In the given example, we have defined
Skip method in java.
Skip method in java. In this tutorial, we will discuss the use of available... void finalize()  The finalize() method ensures...; FileInputStream class. The availabe() method of  the FileInputStream class
Destroy method in java - Java Beginners
Destroy method in java  Hi, What is the implementation of destroy method in java.. is it native or java code? Thanks   Hi Friend, This method is not implemented. Thanks
Java Method with arrays
Java Method with arrays  My assignment is to write a java method..., write a program to test your method. my main method code is : public class...]; currentSmallestIndex = i; } } return currentSmallestIndex; } //main method
method overriding in java
method overriding in java  program to compute area of square,rectangle,triangle,circle and volume of sphere,cylinder and perimeter of a cube using method overriding
method overriding in java
method overriding in java  program to compute area of square,rectangle,triangle,circle and volume of sphere,cylinder and perimeter of a cube using method overriding
customize method in java
customize method in java  hi there i want to create one customize method in which any no of parameters can be pass e.g the limit is 13 and if user wants to enter 3 inputs then that much can only be proceed so can i have solution
Static method in java - Java Beginners
Static method in java  What are static method in Java  Hi Friend, Please visit the following link: Hope that it will be helpful for you
Java static method
Java static method  Can we override static methods
Java Spring Hibernate Struts Training Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java Java Example Codes and Tutorials in 2017 How do I read a large file quickly in Java? Is learning Java worthwhile? How to create first Java Program? Retrieve database from the table dynamically in jsp from oracle using servlet What does core Java include?


Advertisement null