Java final independent variable, javafinal independent variable
Java 1.1 allows us to set the independent variables to the final attribute by declaring them in the list of independent variables. This means that within a method, we cannot change what the independent variable handle points. As follows:
/*** Created by xfyou on 2016/11/2. * demo of final independent variable */public class FinalArguments {void with (final Gizmo g ){//! G = new Gizmo (); // Illegal -- g is final g. spin ();} void without (Gizmo g) {g = new Gizmo (); // OK -- g not final g. spin () ;}// void f (final int I) {I ++ ;}// Can't change // You can only read from a final primitive: int g (final int I) {return I + 1;} public static void main (String [] args) {FinalArguments bf = new FinalArguments (); bf. without (null); bf. with (null) ;}} class Gizmo {public void spin (){}}