How is it different to declare a java interface method signature as final and non final
•
Java
How is it different from declaring a method signature as final and non final in a java interface?
int setName(String name); int setName(final String name);
Solution
Section 8.4.1 of the Java language specification 1. It is allowed to declare parameters in any method declaration (including parameters in the interface) as final However, since this will not affect the signature of the method, declaring the parameters of the abstract function as final will not have any impact Since all methods in the interface are implicitly abstract, both variants are equivalent
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码