grey00
grey00

Reputation: 479

Why doesn't the instanceof operator use camelcase notation?

Foo bar = new Foo();
if(bar instanceof Foo){
    ... // it's true
}

I was just wondering why we don't use camelcase notation (instanceOf) instead of how it is (instanceof).

Upvotes: 8

Views: 415

Answers (3)

user2495765
user2495765

Reputation:

method name is defined as lowerCamelCase https://google-styleguide.googlecode.com/svn/trunk/javaguide.html#s5.2.3-method-names

and operators are predefined symbols

Upvotes: 1

Abhishek
Abhishek

Reputation: 878

because instanceof is an operator, Camel casing is meant for methods and variables

Upvotes: 1

Eran
Eran

Reputation: 393846

instanceof is an operator and a reserved word, not a method or variable. Camel case is used in Java for method names and variable names.

Upvotes: 13

Related Questions