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 9243127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:44:26+00:00 2026-06-18T08:44:26+00:00

Possible Duplicate: Java final modifier This is just a small question about preferences. What

  • 0

Possible Duplicate:
Java final modifier

This is just a small question about preferences. What would be the correct usage for the final modifier?

I have noticed that going from source-to-source that I tend to use it more than others. I put it for the parameters for a method, for variables in the method and what ever I can. Is that necessary or am I just overdoing it?

Reference:

private final int x;
private final int y;
private final int id;
private final int width;
private final int height;

public Widget(final int id, final int x, final int y, final int width, final int height) {
    this.id = id;
    this.x = x;
    this.y = y;
    this.xmod = x;
    this.ymod = y;
    this.width = width;
    this.height = height;
}
  • 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-18T08:44:27+00:00Added an answer on June 18, 2026 at 8:44 am

    Yes, you are overdoing it. Historically, this might have resulted in some optimizations — e.g. final methods can be inlined more easily — but these days, most of those optimizations are done whether or not you actually label the method final.

    The places you should still use final are on most fields in classes, on classes that shouldn’t be, or aren’t, extended, on methods you don’t want overridden, and on local variables that need to get referenced in anonymous inner classes.

    In particular, it is overkill to do it on local variables and on method parameters that will not get wrapped in anonymous inner classes.

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

Sidebar

Related Questions

Possible Duplicate: java: "final" System.out, System.in and System.err? It's just occurred to me although
Possible Duplicate: When should one use final? When should Java programmers prefer to use
Possible Duplicate: Java String.equals versus == I know it' a dumb question but why
Possible Duplicate: Java: Global Exception Handler I thought of something like this: public static
Possible Duplicate: Java: recommended solution for deep cloning/copying an instance I have an object
Possible Duplicate: Why is String final in Java? There are various moments in my
Possible Duplicate: Java Byte Array to String to Byte Array I have a method
Possible Duplicate: Java socket sends some data during connection to server I have two
Possible Duplicate: Drag and Drop Java GUI Hi about 3 months ago I started
Possible Duplicate: Interfaces with static fields in java for sharing ‘constants’ We have constants

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.