Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6706911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:34:34+00:00 2026-05-26T07:34:34+00:00

In Java, what purpose do the keywords final , finally and finalize fulfil?

  • 0

In Java, what purpose do the keywords final, finally and finalize fulfil?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:34:35+00:00Added an answer on May 26, 2026 at 7:34 am

    final

    final can be used to mark a variable “unchangeable”

    private final String name = "foo";  //the reference name can never change
    

    final can also make a method not “overrideable”

    public final String toString() {  return "NULL"; }
    

    final can also make a class not “inheritable”. i.e. the class can not be subclassed.

    public final class finalClass {...}
    public class classNotAllowed extends finalClass {...} // Not allowed
    

    finally

    finally is used in a try/catch statement to execute code “always”

    lock.lock();
    try {
      //do stuff
    } catch (SomeException se) {
      //handle se
    } finally {
      lock.unlock(); //always executed, even if Exception or Error or se
    }
    

    Java 7 has a new try with resources statement that you can use to automatically close resources that explicitly or implicitly implement java.io.Closeable or java.lang.AutoCloseable

    finalize

    finalize is called when an object is garbage collected. You rarely need to override it. An example:

    protected void finalize() {
      //free resources (e.g. unallocate memory)
      super.finalize();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As we know the purpose of final keyword in java. While declaring a variable
What is the purpose of annotations in Java? I have this fuzzy idea of
What is the purpose of these java.lang.annotation imports in this code? Why are they
I am aware that the purpose of volatile variables in Java is that writes
I'm still not clear on the purpose of annotations in Java. Initially I thought
I want to create a purpose built device capable of running a java vm
I am working on a module whose purpose is to process Java exceptions and
For debug purpose, I want to print out current executing function name in Java.
I have a program whose only purpose is to drive a java.awt.Robot in an
Possible Duplicate: What is the purpose of the expression “new String(…)” in Java? I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.