final parameter:If you declare any parameter as final, you cannot change the value of it.
Java Programming Language Class, Object and Methods in java (Article) Class, Object and Methods in java (Program)
857Program:
class Calculation{ int add(final int p){ p=p+2;//can't be changed as n is final return p; } public static void main(String args[]){ Calculation b=new Calculation(); b.add(5); } } /* What is a final parameter? If you declare any parameter as final, you cannot change the value of it. */
Output:
Output:Compile Time Error error: final parameter p may not be assigned p=p+2;//can't be changed as n is final ^ 1 error
This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.