【问题标题】:Why doesn't the instanceof operator use camelcase notation?为什么 instanceof 运算符不使用驼峰表示法?
【发布时间】:2014-12-26 07:10:50
【问题描述】:
Foo bar = new Foo();
if(bar instanceof Foo){
    ... // it's true
}

我只是想知道为什么我们不使用驼峰表示法 (instanceOf) 而不是使用驼峰表示法 (instanceof)。

【问题讨论】:

    标签: java camelcasing


    【解决方案1】:

    instanceof 是运算符和保留字,而不是方法或变量。 Java 中的方法名和变量名使用驼峰式大小写。

    【讨论】:

      【解决方案2】:

      因为instanceof 是运算符,所以Camel casing 用于方法和变量

      【讨论】:

        【解决方案3】:

        方法名定义为 lowerCamelCase https://google-styleguide.googlecode.com/svn/trunk/javaguide.html#s5.2.3-method-names

        和运算符是预定义的符号

        【讨论】:

          猜你喜欢
          • 2011-01-27
          • 2014-11-05
          • 2019-02-07
          • 1970-01-01
          • 2011-11-10
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-07-29
          相关资源
          最近更新 更多