我是靠谱客的博主 大意中心,最近开发中收集的这篇文章主要介绍java 变量下划线,在Java变量和方法名称中使用下划线,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

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 变量下划线,在Java变量和方法名称中使用下划线所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(40)

评论列表共有 0 条评论

立即
投稿
返回
顶部