Teaching girls to learn Java (35): the usage of final keyword

Hello, I am the second silent king, (currently) the top ten blog expert in CSDN Week. This is the thirty-fifth article of the column "Teach Girls to Learn Java". Today we will talk about Java's final keyword-what are the uses of the final keyword?

The code in this column has been included in  GitHub  github.com/itwanger  , and there are also interview questions I prepared carefully for you.

The third sister has started school and learned computer software programming. Her school is very close to my home, and it is only 10 stops away by bus. She will come to me every weekend and ask me to help her learn Java. As a programmer with more than ten years of programming experience, coupled with the blood relationship given to us by our parents, I feel obligated.

"Second brother, what we are going to learn today is'final keywords', right?" It seems that the third sister has previewed the homework I left for her last time.

"Yes, Sanmei. The final keyword has many uses." I answered her with an unpretentious smile, "It can be used to modify variables, modify methods, and modify classes."

----The dividing line of the Eight Classics of Zhenger, the beginning of the text ------------

01, final variables

Any variable can be modified with final, and the modified variable value cannot be modified.

Guess you like

Origin blog.csdn.net/qing_gee/article/details/108730700