answersLogoWhite

0

The use of final denotes that a variable is a constant. For example:

final int PI = 3.14;

makes PI a constant. This is useful because now PI can't be changed, even accidentally, by you, the program, another programmer, or a user. Once a value is final, it is permanent, and can be used as a constant.

Note: usually programmers capitalize the names of constants, just to make it clear that the value is a constant.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

Is unsigned integer constant are available in Java?

yes use the final keyword, normally variables declared final use all capital letters but this is not required final int A = 10;


Do you use virtual functions in Java?

Every method in java that isn't a class (static) method is automatically "virtual." If you want to disable virtual overrides, make the method "final" in the base class.


What are sealed classes in java?

Final classes are sealed classes in java I guess.


What modifier do you use to prevent that class from having any subclasses?

In Java, you use the final modifier to prevent a class from having any subclasses.


What is public static final variable in java?

-Public to all - Static to access with Class Name - Final to change( constant and not alowed to change) Just use it along with class name. (As implied above, a 'public static final' variable in Java is what other languages would call a Constant. )


How does the final keyword affect the behavior of Object type in Java?

In Java, the final keyword specifies that the object created cannot be further redefined or derived.


Can you make a class final in java?

yes of course... using the final keyword


How do you prevent class extending in java?

Declare the class as final. final class A{ ... }


Can you declears static in a local variable in a method in java?

we cannot use the staic keyword inside the method... But we can use the final keyword inside the method....


Can you use pointers in java?

Java does not support Pointers and hence you cannot use it in Java.


Final classes in java?

A class declared as final means that no other class can inherit from it.


What is the return type of finally method in java?

The final and finally keywords have no impact on the return type of a method in Java.