Rabu, 14 Desember 2016

What is the usage of the final keyword in programming

Following are the uses of final keyword in Java: To declare constant values To make a method non-overridable To make a class non-inheritable The second and third uses of final are applicable only in the context of inheritance. Let’s look at each of the uses of final keyword in detail.   Declaring constant values The first use of final is to declare constant values in Java programs. Syntax for declaring a constant is shown below: final data-type variable-name = value; An example for declaring constants is given below: final float PI = 3.1415; In Java, you have to assign the value for the constant in the

The post What is the usage of the final keyword in programming appeared first on Coding Security.


What is the usage of the final keyword in programming
read more

Tidak ada komentar:

Posting Komentar