On the importance of Java access control

In front of what is the easiest person to lose resistance?

Beauty is a. For example, Xi Shi's contribution is to bear humiliation, serve the country by example and help Yue destroy Wu; Money is another thing. Our ancients often said that "money comes from things outside the body, not from life, not from death", but we all know that "money can make ghosts grind".

In addition to beauty and money, I think there is another one, which is the recognition of readers - "second brother, your article is really great, and I like it very much. I hope to update the basic knowledge of Java more, which really benefits a lot. It's like reading Wang Xiaobo's prose, but learning programming!"—— You say that you still need beauty and money to receive such warm comments from readers? "Both can be thrown away".

This article mainly introduces the access control of Java.

Shu Qi once said such a shocking sentence: "I want to put back the clothes I took off one by one!" Now, she has done it - through her own efforts, she has not only been recognized by the audience, won many awards, but also gained happiness. Although, really, some friends who "recall the extraordinary years of the past" retained some rare photos of Shu Qi's early years in the depths of the computer hard disk. I use this example to prove that access control (or hiding the specific implementation) is not appropriate for the original implementation Relevant - if Shu Qi's permission for those photos was not so public at the beginning, it can now be burned privately; Or another way to get out; However, there is no if. In your initial programming career, I don't know whether you have created the following "excellent" code, just like listing 1-1. Program listing 1-1: originally, you just wrote the code yourself. Who knows that it was called by a colleague named little second brother without consideration. This call doesn't matter. The second brother's code has really waited all day - Mr. Wang, the product manager, on a whim one day, had to test the second brother's code, and then clicked the button to check the next day. The program really waited there quietly until the next day. As a result, in order to appease the restless mood of users, Mr. Wang directly pulled the little second brother out to worship the heaven; You hide in the corner trembling and silently say, "little second brother, you go well, brother, I'm really sorry". A bloody tragedy! Just because of the improper use of Java access control -- the private method, the result is written as public -- on the importance of access control.

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
分享
二维码
< <上一篇
下一篇>>