Even nowadays I often see underscores in Java variables and methods, an example are member variables (like "m_count" or "_count"). As far as I remember, to use underscores in these cases is called bad style by Sun.
The only place they should be used is in constants (like in "public final static int IS_OKAY = 1;"), because constants should be all upper case and not camel case. Here, the underscore should make the code more readable.
Do you think using underscores in Java is bad style? If so (or not), why?
解决方案
If you have no code using it now, I'd suggest continuing that. If your codebase uses it, continue that.
The biggest thing about coding style is consistency. If you have nothing to be consistent with, then the language vendor's recommendations are likely a good place to start.
最后
以上就是大意中心最近收集整理的关于java 变量下划线,在Java变量和方法名称中使用下划线的全部内容,更多相关java内容请搜索靠谱客的其他文章。
发表评论 取消回复