Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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).

like image 745
grey00 Avatar asked Dec 26 '14 07:12

grey00


People also ask

What is the purpose of CamelCase?

CamelCase is a way to separate the words in a phrase by making the first letter of each word capitalized and not using spaces. It is commonly used in web URLs, programming and computer naming conventions. It is named after camels because the capital letters resemble the humps on a camel's back.

What is the return type of Instanceof operator?

Java instanceof Operator The instanceof operator in Java is used to check whether an object is an instance of a particular class or not. objectName instanceOf className; Here, if objectName is an instance of className , the operator returns true . Otherwise, it returns false .

What is an Instanceof?

instanceof is a binary operator we use to test if an object is of a given type. The result of the operation is either true or false. It's also known as a type comparison operator because it compares the instance with the type. Before casting an unknown object, the instanceof check should always be used.

What is CamelCase in programming example?

The name refers to the internal capital letters, which resemble the humps on a camel's back. For example, ComputerHope, FedEx, and WordPerfect are all examples of CamelCase. With computer programming, CamelCase is often used as a naming convention for variables, arrays, and other elements.


2 Answers

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.

like image 67
Eran Avatar answered Oct 24 '22 09:10

Eran


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

like image 41
Abhishek Avatar answered Oct 24 '22 09:10

Abhishek