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) — A method in object-oriented programming (OOP) is a procedure associated with an object, and generally also a message. An object consists of state data and behavior; these compose an interface, which specifies how the object may be used. A method is a behavior of an object parametrized by a user.
Misconceptions about Method49 documented Misconceptions
Check YourselfAddMemberAtRuntime — Java
Set of class members can change at runtimeArrayHasLengthMethod — Java
To get the length of an array, one needs to call its length methodBaseCaseNotNeeded — Java
Recursive computations do not necessarily need a base caseBaseCaseSelfRecursive — Java
The base case of a structural recursion consists of a recursive self-callCallNotStaticallyChecked — Java
A method invocation on a reference of a type that does not have that method won't compileCallOnPrimitive — Java
One can invoke a method on primitive valuesCallRequiresVariable — Java
One needs a variable to invoke a methodCallWithoutFrame — Java
A method invocation does not necessarily allocate a stack frameCallerFrameContainsCalleeFormal — Java
Stack frame of caller includes variables for callee's formal parametersCannotChainAttributeToObjectInstantiation — Python
Method calls, and attribute accesses in general, cannot be chained to a constructor invocation.CannotChainMemberAccesses — Java
Member accesses cannot be chained togetherCannotChainMemberToConstructor — Java
Method calls or field accesses cannot be chained to a constructor invocationChainedMethodsNotCalledFromOutside — Java
Chained methods are all called on the object at the beginning of the chainConcreteClassMustOverride — Java
A concrete class needs to implement all methods declared in its abstract superclassesConcreteClassOnlyImplementClassAbstract — Java
A concrete class only needs to implement those abstract methods it inherits from abstract superclassesConcreteClassOnlyImplementDirectAbstract — Java
A concrete class only needs to implement abstract methods declared in its direct supertypesConcreteClassOnlyImplementInterfaceAbstract — Java
A concrete class only needs to implement those abstract methods it inherits from interfacesDeferredReturn — Java
A return statement in the middle of a method doesn't return immediatelyEqualsComparesReferences — Java
o.equals(p) compares the references stored in the variables o and pImmutableRequiresFinalParameters — Java
Immutable classes need final constructor/method parametersImplicitInterfaceImplementation — Java
Java implicitly produces implementations of any methods a class inherits from the interfaces it implementsInterproceduralEdge — Java
In an intra-procedural control-flow graph, method call nodes point to the called methodMethodAsField — Java
Each object contains its own special fields for all of its methodsMethodWithoutReturnType — Java
A method declaration does not need to include a return typeMethodsWithoutClass — Java
Methods can be defined outside a classNoCallOnStringLiteral — Java
One cannot invoke methods on String literalsNoInsideMethodCallInConstructor — Java
It is foirbidden to call other methods on the same object while inside its constructorNoMethodInheritance — Java
Subclasses inherit fields but not methodsNoStringToString — Java
One cannot invoke toString() on a StringOutsideInMethodNesting — Java
Nested method calls are invoked outside inParenthesesOnlyIfArgument — Java
() are optional for method calls without argumentsPrivateAccessibleInSubclass — Java
Private members of a superclass are accessible from a subclassRecursiveMethodImpliesRecursiveType — Java
A class with a recursive method represents part of a recursive data structureRecursiveMethodNeedsIfElse — Java
A recursive method needs to contain an if-else statementReturnCall — Java
Return statements need () around the return valueRightToLeftChaining — Java
Chained accesses are invoked from right to leftRightToLeftChaining — Python
Chained accesses are invoked from right to leftSetterIsStatic — Java
Setter methods are staticStackTraceIsCallHistory — Java
A stack trace is the sequence of previously called methodsStaticCallPolymorphic — Java
A static method call is dispatched polymorphically at runtime based on the argument typesStaticDispatch — Java
The method to be called is determined by the static typeStaticFrameInGlobals — Java
Stack frame of static method calls lives in the global memory areaStringLengthField — Java
One can know the length of a String object by accessing its length fieldThisChildInCallExpression — Java
Instance method or constructor call nodes in expression trees have a child labeled "this"ThisExistsInStaticMethod — Java
this is a local variable, also in static methodsToStringPrints — Java
Invoking toString() prints somethingUseOfSelfTypeImpliesRecursiveType — 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 typeVoidMethodNotRecursive — Java
A method with void return type can't be recursiveVoidMethodReturnsValue — Java
A method with void return type can return a value