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

  • Home
  • SEARCH
  • 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 9127449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:17:06+00:00 2026-06-17T07:17:06+00:00

when we use final keyword that variable has been declared as constant then what

  • 0

when we use final keyword that variable has been declared as constant then what is the necessity of using static ?
I have seen in most of the places that we use

public static final int nVar = 12

for constant data member .

  • 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-06-17T07:17:07+00:00Added an answer on June 17, 2026 at 7:17 am

    final means that, once assigned the value of variable cannot be modified.

    static means “associated with the class”; without it, the variable is associated with each instance of the class. if not, you’ll have one for each instance you create. static means the variable will remain in memory for as long as the class is loaded

    There is no point in declaring a variable like this.

    public final int nVar = 12;
    

    If this is not meant to be modified, why have one copy per instance.

    Hence, Class constants need to be declared as static final where as the variables which you want to be immutable on per instance basis, you declare them as final

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've seen answers on here that you can use final static const variables in
I'm using Jboss 7.1.1.final and i have an application with heavy use of JMS.
Possible Duplicate: When should I use “final”? PHP has a keyword 'final', Could you
I'm very new to Java but I've been developing a habit to use final
So I have a Singleton class and in it a non-static public method that
Possible Duplicate: When to use final What is the use of declaring final keyword
I have strange behavior of the static final values in my interface: public interface
The new introduced code convention require to use the final keyword where possible. The
I have a problem understanding and using the 'vec' keyword. I am reading a
While there are many reasons to use the 'final' keyword in Java , one

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.