- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is a final parameter in java?
You can pass final variables as the parameters to methods in Java.
A final variable can be explicitly initialized only once. A reference variable declared final can never be reassigned to refer to a different object. However, the data within the object can be changed. So, the state of the object can be changed but not the reference. With variables, the final modifier often is used with static to make the constant a class variable.
Example
public class Test{ public void sample(final int data){ System.out.println(data); } public static void main(String args[]) throws Exception{ Test t = new Test(); t.sample(500); } }
Output
500
- Related Articles
- What is final parameter in Java
- What is a final method in Java?
- What is a final variable in java?
- What is a blank uninitialized final variable in java?
- What is blank final variable? What are Static blank final variables in Java?
- What is static blank final variable in Java?
- Is StringBuffer final in Java?
- What is blank or uninitialized final variable in Java?
- What are final classes in Java?
- Is final method inherited in Java?
- What is parameter destructuring in TypeScript?
- What is the difference between final, finally and finalize() in Java?
- What is the equivalent of Java static final fields in Kotlin?
- Make a class final in Java
- What is the syntax for passing Scanner object as a parameter in a method using java?

Advertisements