Java Language Specification, Version Java SE 21 Edition
15.12. Method Invocation Expressions14 Documented Misconceptions
CallNotStaticallyChecked
A method invocation on a reference of a type that does not have that method won't compileCallOnPrimitive
One can invoke a method on primitive valuesCallRequiresVariable
One needs a variable to invoke a methodCannotChainMemberAccesses
Member accesses cannot be chained togetherCannotChainMemberToConstructor
Method calls or field accesses cannot be chained to a constructor invocationChainedMethodsNotCalledFromOutside
Chained methods are all called on the object at the beginning of the chainLiteralString
When passing a literal string as argument to a method, no quotes are neededNoCallOnStringLiteral
One cannot invoke methods on String literalsOutsideInMethodNesting
Nested method calls are invoked outside inParenthesesOnlyIfArgument
() are optional for method calls without argumentsRightToLeftChaining
Chained accesses are invoked from right to leftStaticDispatch
The method to be called is determined by the static typeStaticCallPolymorphic
A static method call is dispatched polymorphically at runtime based on the argument typesSuperAlwaysHasParentheses
To call a method on a superclass, parentheses are needed after the keyword super