Java - Class final Parameters

Introduction

You can declare a formal parameter final.

A formal parameter is initialized with the value of the actual parameter.

You cannot change the value of a final formal parameter inside the method.

public void test2(final int x) {
    /* Can read x, but cannot change it */
    x = 0;//error

}

Related Topic