Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2019-09-04:Kotlin中的可见性修饰符有哪些?相比于Java有什么区别? #140

Open
Moosphan opened this issue Sep 4, 2019 · 1 comment
Labels

Comments

@Moosphan
Copy link
Owner

Moosphan commented Sep 4, 2019

No description provided.

@Moosphan Moosphan added the Kotlin label Sep 4, 2019
@gabyallen
Copy link

kotlin存在四种可见性修饰符,默认是public。 private、protected、internal、public
1.private、protected、public是和java中的一样的。
2.不同的是java中默认是default修饰符(包可见),而kotlin存在internal修饰符(模块内部可见)。
3.kotlin可以直接在文件顶级声明方法、变量等。其中protected不能用来修饰在文件顶级声明的类、方法、变量等。
构造方法默认是public修饰,可以使用可见性修饰符修饰constructor关键字来改变构造方法的可见性。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants