Discuz! Board

 找回密碼
 立即註冊
搜索
熱搜: 活動 交友 discuz
查看: 4|回復: 0
打印 上一主題 下一主題

This is the default value when there is no access

[複製鏈接]

1

主題

1

帖子

2

積分

新手上路

Rank: 1

積分
2
跳轉到指定樓層
樓主
發表於 2024-5-16 13:51:29 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
There are several basic access modifiers Public – “public, accessible to everyone.” Default – “by default”.  modifier. Information with this word is available within the package. Protected - “protected”. It is similar to default, but differs in that its descendant classes also have access. Private – “private, personal”. This information is visible only to the class itself.

We are giving a discount of on training “Java Programmer” until March In just  Bulgaria Email List months you can get a job with an income of , rubles Book a discount How is the safety principle ensured? It is possible to easily change this variable and string, which is not entirely good, since anyone can do this from any part of the program. If we don't need this, we change the modifier from public to private class MyClass { private String s "Hello World!" } class MyClass { private String s "Hello World!" } In this case, when trying to access variable s (read or write), an error will occur.

   


In this way, we managed to protect the variable from ill-wishers. The most important thing is that we manage to control what is happening. Now no one has the ability to change or read our variables. Encapsulation in Python The Python system provides three-level access to data public (public, no special syntax, publicBanana) protected (protected, highlighted by a single underscore at the beginning of the name, protectedBanana) private (private, highlighted by a double underscore at the beginning of the name, privateBanana).



回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即註冊

本版積分規則

Archiver|手機版|自動贊助|GameHost抗攻擊論壇  

GMT+8, 2025-4-23 12:11 , Processed in 0.137352 second(s), 5 queries , File On.

抗攻擊 by GameHost X3.3

© 2001-2017 Comsenz Inc.

快速回復 返回頂部 返回列表
一粒米 | 中興米 | 論壇美工 | 設計 抗ddos | 天堂私服 | ddos | ddos | 防ddos | 防禦ddos | 防ddos主機 | 天堂美工 | 設計 防ddos主機 | 抗ddos主機 | 抗ddos | 抗ddos主機 | 抗攻擊論壇 | 天堂自動贊助 | 免費論壇 | 天堂私服 | 天堂123 | 台南清潔 | 天堂 | 天堂私服 | 免費論壇申請 | 抗ddos | 虛擬主機 | 實體主機 | vps | 網域註冊 | 抗攻擊遊戲主機 | ddos |