Method
A method is a function that is a member of a class and may operate on an object.
Related concepts: FunctionMemberClassObject
Closest Wikipedia entry: Method (computer programming)
Misconceptions about Method46 documented Misconceptions
Check YourselfAddMemberAtRuntime — Java
Set of class members can change at runtime
ArrayHasLengthMethod — Java
To get the length of an array, one needs to call its length method
BaseCaseNotNeeded — Java
Recursive computations do not necessarily need a base case
BaseCaseSelfRecursive — Java
The base case of a structural recursion consists of a recursive self-call
CallNotStaticallyChecked — Java
A method invocation on a reference of a type that does not have that method won't compile
CallOnPrimitive — Java
One can invoke a method on primitive values
CallRequiresVariable — Java
One needs a variable to invoke a method
CallWithoutFrame — Java
A method invocation does not necessarily allocate a stack frame
CallerFrameContainsCalleeFormal — Java
Stack frame of caller includes variables for callee's formal parameters
CannotChainMemberAccesses — Java
Member accesses cannot be chained together
CannotChainMemberToConstructor — Java
Method calls or field accesses cannot be chained to a constructor invocation
ChainedMethodsNotCalledFromOutside — Java
Chained methods are all called on the object at the beginning of the chain
ConcreteClassMustOverride — Java
A concrete class needs to implement all abstract methods and override all concrete methods declared in its abstract superclasses
ConcreteClassOnlyImplementClassAbstract — Java
A concrete class only needs to implement those abstract methods it inherits from abstract superclasses
ConcreteClassOnlyImplementDirectAbstract — Java
A concrete class only needs to implement abstract methods declared in its direct supertypes
ConcreteClassOnlyImplementInterfaceAbstract — Java
A concrete class only needs to implement those abstract methods it inherits from interfaces
DeferredReturn — Java
A return statement in the middle of a method doesn't return immediately
EqualsComparesReferences — Java
o.equals(p) compares the references stored in the variables o and p
ImmutableRequiresFinalParameters — Java
Immutable classes need final constructor/method parameters
ImplicitInterfaceImplementation — Java
Java implicitly produces implementations of any methods a class inherits from the interfaces it implements
MethodAsField — Java
Each object contains its own special fields for all of its methods
MethodWithoutReturnType — Java
A method declaration does not need to include a return type
MethodsWithoutClass — Java
Methods can be defined outside a class
NoCallOnStringLiteral — Java
One cannot invoke methods on String literals
NoInsideMethodCallInConstructor — Java
It is foirbidden to call other methods on the same object while inside its constructor
NoMethodInheritance — Java
Subclasses inherit fields but not methods
NoStringToString — Java
One cannot invoke toString() on a String
OutsideInMethodNesting — Java
Nested method calls are invoked outside in
ParenthesesOnlyIfArgument — Java
() are optional for method calls without arguments
PrivateAccessibleInSubclass — Java
Private members of a superclass are accessible from a subclass
RecursiveMethodImpliesRecursiveType — Java
A class with a recursive method represents part of a recursive data structure
RecursiveMethodNeedsIfElse — Java
A recursive method needs to contain an if-else statement
ReturnCall — Java
Return statements need () around the return value
RightToLeftChaining — Java
Chained accesses are invoked from right to left
StackTraceIsCallHistory — Java
A stack trace is the sequence of previously called methods
StaticCallPolymorphic — Java
A static method call is dispatched polymorphically at runtime based on the argument types
StaticDispatch — Java
The method to be called is determined by the static type
StringLengthField — Java
One can know the length of a String object by accessing its length field
ThisExistsInStaticMethod — Java
this is a local variable, also in static methods
ToStringPrints — Java
Invoking toString() prints something
UseOfSelfTypeImpliesRecursiveType — Java
If a class has a method that has a local variable, parameter, or return value with the class as its type, the class is a recursive type
VoidMethodNotRecursive — Java
A method with void return type can't be recursive
VoidMethodReturnsValue — Java
A method with void return type can return a value
CannotChainAttributeAccesses — Python
Attribute accesses cannot be chained together
CannotChainAttributeToObjectInstantiation — Python
Method calls, and attribute accesses in general, cannot be chained to a constructor invocation.
RightToLeftChaining — Python
Chained accesses are invoked from right to left