In tis tutorial,We will discuss about Final keyword in Java programming language
final is a Java keyword, it is used to restrict the user, When the variable is defined as final, you can not changed the value of the final variable. So its constant The final key word can be use 3 situations
know more about final, click Usage of final in Java programming language
When the method is defined as final method – prevent method over riding
When the method is defined as final method – prevent class inheritance
final variable define as
Syntax
<final><data_type><variable_name>=value;
Example
final int MY_AGE=23; //this value can not be changed
final method define as
Syntax
<final><return_type><method_name>
Example
final void demo(){}
final class define as
Syntax
<final><class><class_name>{}
Example
final class parent{}
There are other Java language keywords that are similar to this keyword
float keyword in Java
Usage of this statement in the Java language
Usage of final in Java programming language
C# inverted full pyramid star pattern In this article, we will discuss the concept of…
C# Full Pyramid star pattern program In this article, we will discuss the concept of…
Program to count vowels, consonants, words, characters and space in Java In this article, we…
How to print multiplication table using Array in C++ language In this post, we will…
C Program to multiplication table using Array In this tutorial , we will discuss about…
Java program to check odd or even using recursion In this tutorial, we discuss a…