Easy learning with example program codes

what is final parameter in java?

A method parameter declared with final keyword is known as final parameter. Its value can’t be changed.


 * This program is used to show that value of 
 * final parameter can't be changed.
 * @author CodesJava
class Test{
	public void showDouble(final int num){
		//error because value of final parameter can't be changed.
		num = num * 2;
		System.out.println("Num * 2 = " + num);
public class FinalExample7 {
	public static void main(String args[]){
		//creating object of Test class
		Test obj = new Test();
		//method call


Exception in thread "main" java.lang.Error: 
Unresolved compilation problem:
The final local variable num cannot be assigned. 
It must be blank and not using a compound assignment

Java interview questions on final keyword

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki