If they do, when do they use it so I can understand it better and know when to use it.

A final class is simply a class that can't be extended.

(It does not mean that all references to objects of the class would act as if they were declared as final.)

When it's useful to declare a class as final is covered in the answers of this question:

  • Good reasons to prohibit inheritance in Java?

If Java is object oriented, and you declare a class final, doesn't it stop the idea of class having the characteristics of objects?

In some sense yes.

By marking a class as final you disable a powerful and flexible feature of the language for that part of the code. Some classes however, should not (and in certain cases can not) be designed to take subclassing into account in a good way. In these cases it makes sense to mark the class as final, even though it limits OOP. (Remember however that a final class can still extend another non-final class.)

Answer from aioobe on Stack Overflow
🌐
Oracle
docs.oracle.com › javase › tutorial › java › IandI › final.html
Writing Final Classes and Methods (The Java™ Tutorials > Learning the Java Language > Interfaces and Inheritance)
The Object class does this—a number of its methods are final. You might wish to make a method final if it has an implementation that should not be changed and it is critical to the consistent state of the object. For example, you might want to make the getFirstPlayer method in this ChessAlgorithm class final:

If they do, when do they use it so I can understand it better and know when to use it.

A final class is simply a class that can't be extended.

(It does not mean that all references to objects of the class would act as if they were declared as final.)

When it's useful to declare a class as final is covered in the answers of this question:

  • Good reasons to prohibit inheritance in Java?

If Java is object oriented, and you declare a class final, doesn't it stop the idea of class having the characteristics of objects?

In some sense yes.

By marking a class as final you disable a powerful and flexible feature of the language for that part of the code. Some classes however, should not (and in certain cases can not) be designed to take subclassing into account in a good way. In these cases it makes sense to mark the class as final, even though it limits OOP. (Remember however that a final class can still extend another non-final class.)

Answer from aioobe on Stack Overflow
People also ask

What is a final class in Java?
A final class in Java is a class that cannot be extended or inherited. Once declared final, no other class can subclass it. This ensures the class’s behavior remains unchanged and is often used in secure or utility-based Java code. A final class in Java is a class that cannot be extended or inherited. Once declared final , no other class can subclass it. This ensures the class’s behavior remains unchanged and is often used in secure or utility-based Java code.
🌐
upgrad.com
upgrad.com › home › tutorials › software & tech › final class in java
Final Class in Java | Meaning, Method & Example Explained
Can a final class in Java have final methods?
Yes, a final class in Java can contain both final and non-final methods. However, since the class itself can’t be extended, marking its methods as final has limited impact beyond internal clarity or intent. Yes, a final class in Java can contain both final and non-final methods. However, since the class itself can’t be extended, marking its methods as final has limited impact beyond internal clarity or intent.
🌐
upgrad.com
upgrad.com › home › tutorials › software & tech › final class in java
Final Class in Java | Meaning, Method & Example Explained
Why do we use final classes in Java?
Final classes in Java are used to prevent inheritance and protect the original class design. They're ideal for creating immutable classes or securing critical utility classes that shouldn't be modified or extended by other parts of the program. Final classes in Java are used to prevent inheritance and protect the original class design. They're ideal for creating immutable classes or securing critical utility classes that shouldn't be modified or extended by other parts of the program.
🌐
upgrad.com
upgrad.com › home › tutorials › software & tech › final class in java
Final Class in Java | Meaning, Method & Example Explained
🌐
Wikipedia
en.wikipedia.org › wiki › Final_(Java)
final (Java) - Wikipedia
October 29, 2025 - For example, the following code defines a coordinate system whose origin should always be at (0, 0). The origin is implemented using a java.awt.Point though, and this class defines its fields as public and modifiable. This means that even when reaching the origin object over an access path with only final variables, that object can still be modified, as the below example code demonstrates. import java.awt.Point; public class FinalDemo { static class CoordinateSystem { private final Point origin = new Point(0, 0); public Point getOrigin() { return origin; } } public static void main(String[] args) { CoordinateSystem coordinateSystem = new CoordinateSystem(); coordinateSystem.getOrigin().x = 15; assert coordinateSystem.getOrigin().getX() == 0; } }
🌐
Upgrad
upgrad.com › home › tutorials › software & tech › final class in java
Final Class in Java | Meaning, Method & Example Explained
June 24, 2025 - Can you prevent a class in Java from being inherited—and why would you want to? That’s the exact purpose of a final class in Java. When you declare a class as final, you restrict other classes from extending it.
🌐
Whitman College
whitman.edu › mathematics › java_tutorial › java › javaOO › final.html
Writing Final Classes and Methods
To prevent this kind of subversion, you can declare your class to be final and prevent any subclasses from being created. The String class in the java.lang package is a final class for just this reason.
🌐
JavaGoal
javagoal.com › home › final class in java
Final Class in Java & Use of Final Class Java with Example
November 7, 2022 - By use of the final class, we can restrict the inheritance of the class. We can create a class as a final class only if it is complete in nature, which means it must not be an abstract class.
Find elsewhere
🌐
TutorialsPoint
tutorialspoint.com › What-are-final-classes-in-Java
What are final classes in Java?
The final modifier for finalizing the implementations of classes, methods, and variables. The main purpose of using a class being declared as final is to prevent the class from being subclassed. If a class is marked as final then no class c
🌐
Quora
quora.com › What-is-the-use-of-the-final-class-in-Java
What is the use of the final class in Java? - Quora
Answer (1 of 7): Sometime you do want to prevent your class to be extended further. * Immutability: If you want to create a java class immutable, you need to make that class final. Immutable class is needed in java for sharing an object in multi-threaded environment. In map like data structure,...
🌐
Scaler
scaler.com › topics › final-class-in-java
Final Class in Java | Scaler Topics
July 21, 2022 - As the name suggests, the Final Class in Java uses the final keyword for its declaration. The final keyword in Java restricts the user; similarly, the final class means that the class cannot be extended. We can only create a final class if it is complete, which means it cannot be an abstract class.
🌐
Baeldung
baeldung.com › home › java › core java › the “final” keyword in java
The "final" Keyword in Java | Baeldung
June 14, 2025 - Methods marked as final cannot be overridden. When we design a class and feel that a method shouldn’t be overridden, we can make this method final. We can also find many final methods in Java core libraries.
🌐
Blogger
javarevisited.blogspot.com › 2011 › 12 › final-variable-method-class-java.html
What is final in Java? Final variable , Method and Class Example
The final class is complete in nature and can not be sub-classed or inherited. Several classes in Java are final e.g. String, Integer, and other wrapper classes. Here is an example of final class in java ... 1. Final keyword improves performance.
🌐
Blog
cipherschools.com › home › others › what are final class in java with examples
What are Final Class in Java with Examples - Blog | Cipherschools: The Best Learning Platform
September 18, 2025 - Yes, final classes can have static methods. The “final” keyword only restricts subclassing, not the inclusion of static methods. ... No, the “final” keyword in Java ensures that the value assigned to a final variable cannot be changed after initialization, including being set to null.
🌐
Hero Vired
herovired.com › home › learning-hub › topics › final-class-in-java
Final Class in Java : Tutorial with Examples By Hero Vired
This class definition should be complete and not abstract. Here is the syntax for creating the final class. ... In Java, we can define the final class using the final keyword by implementing the before-the-class keyword.
🌐
Princeton
cs.princeton.edu › courses › archive › spr96 › cs333 › java › tutorial › java › javaOO › final.html
Writing Final Classes and Methods
The subclass looks and feels like the original class but does vastly different things possibly causing damage or getting into private information. To prevent this kind of subversion, you can declare your class to be final and prevent any subclasses from being created. The String class in the java.lang package is a final class for just this reason.
🌐
DataCamp
datacamp.com › doc › java › final
final Keyword in Java: Usage & Examples
Design: Use final classes to prevent inheritance when designing immutable classes or when you want to ensure that the class's implementation cannot be altered. Static Final Variables: Unlike instance final variables, static final variables cannot be assigned via constructors.
🌐
GeeksforGeeks
geeksforgeeks.org › java › final-keyword-in-java
final Keyword in Java - GeeksforGeeks
Final classes are useful when creating immutable classes such as String or wrapper classes. When a method is declared with final keyword, it is called a final method in Java.
Published   July 22, 2014
🌐
Medium
medium.com › @ByteCodeBlogger › javas-final-frontier-creating-immutable-and-unextendable-classes-in-java-9fc253a40c58
Java’s Final Frontier: Creating Immutable and Unextendable Classes in Java | by Full Stack Developer | Medium
July 23, 2024 - Creating a final class in Java is straightforward: you simply use the final keyword in the class declaration. A final class cannot be extended (subclassed).
🌐
GeeksforGeeks
geeksforgeeks.org › java › using-final-with-inheritance-in-java
Using final with Inheritance in Java - GeeksforGeeks
July 23, 2025 - We can declare a final method in any subclass for which we want that if any other class extends this subclass, then it must follow the same implementation of the method as in that subclass.
🌐
TutorialsPoint
tutorialspoint.com › make-a-class-final-in-java
Make a class final in Java
This means that it cannot be inherited. It has a private data member a and a method printA() that displays the value of a. A code snippet which demonstrates this is as follows: final class A { private int a = 15; public void printA() { System.out.println("Value of a = " + a); } }