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

你好,关于synchronized 修饰静态方法的问题 #40

Closed
est7 opened this issue Dec 21, 2016 · 2 comments
Closed

你好,关于synchronized 修饰静态方法的问题 #40

est7 opened this issue Dec 21, 2016 · 2 comments

Comments

@est7
Copy link

est7 commented Dec 21, 2016

请问一下在Application里面有一个
public static synchronized App getInstance() {
return instance;
}
方法,为什么这里要用synchronized 关键字修饰

@codeestX
Copy link
Owner

@est7 Hello,单例模式的一种写法,为了线程安全

@est7
Copy link
Author

est7 commented Dec 21, 2016

谢谢我在补一下

@est7 est7 closed this as completed Dec 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants