PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

Java · Theory

Final Keyword in Java

← All stacks

Theory

40/270

Final Keyword in Java

final means do not change this further — but the exact meaning depends on where you put it. final variable: cannot reassign after it is set. final method: child cannot override it. final class: nobody can extend it.

Common pattern: final int MAX = 100;. If the variable holds an object, the reference is fixed. Fields inside that object can still change unless the object itself is immutable.

Explain all three in three lines in an interview: variable, method, class.

Let's take this on the board with one tiny Main class — no extra files. Final Keyword in Java — output: 100. Uncomment MAX = 200 and javac fails — final cannot be reassigned. Start from main, go line by line, and stop at each print. That output is the proof for Final Keyword.

Exam tip

Three meanings of final — variable, method, class.

Example

public class Main {
  public static void main(String[] args) {
    final int MAX = 100;
    System.out.println(MAX);
    // MAX = 200; // compile error
  }
}

Final Keyword in Java — output: 100. Uncomment MAX = 200 and javac fails — final cannot be reassigned.

Short notes

  • Deffinal = do not change this further. Meaning depends on where you put it.
  • Rulefinal var = no reassign. final method = no override. final class = no extend.
  • Trapfinal object reference is fixed; fields inside may still change.
  • Usefinal int MAX = 100;

Questions

1

What does final variable mean?

2

What does final method mean?

3

What does final class mean?

4

Does final object freeze all fields?

Previous← Instance Initializer Block in JavaNextPolymorphism in Java →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.