DRAFT
Observed
One needs a variable to invoke a method
Methods can be invoked on expressions that evaluate to a suitable object
One can invoke a method on an object without the reference to that object being stored in a variable. All that is needed is that the expression in front of the ”.” of the call evaluates to an object reference.
For example, one can do method chaining on a normal method:
get().m(); // assuming get() returns an objectOr one can do method chaining on a constructor:
new C().m();Or one can call a method on an String literal:
"Hi".toString();Or one can call a method on an object one gets out of an array:
a[0].m();The following papers directly or indirectly provide qualitative or quantitative evidence related to this misconception.
