Methods - Learning Objectives & Essential Knowledge
LEARNING OBJECTIVE		
Call static methods.		
Define behaviors of a class through static methods.		
Define the static variables that belong to the class.		
Designate access and visibility constraints to classes and methods.		
Explain where variables can be used in the program code.		

ESSENTIAL KNOWLEDGE		
Through method decomposition, a programmer breaks down a large problem into
smaller sub-problems by creating methods to solve each individual sub-problem.		
Procedural abstraction allows a programmer to use a method by knowing what the method does even if they do not know how the method was written.		
Classes are designated public.		
Static methods are associated with the class, not objects of the class.		
A void method does not return a value. Its header contains the keyword void before the method name.		
Void methods do not have return values and are therefore not called as part of an expression.		
The return keyword is used to return the flow of control to the point immediately following where the method was called.		
Static variables belong to the class, with all objects of a class sharing a single static variable.		
Static variables can be designated as either public or private and are designated with the static keyword before the variable type.		
Static methods include the keyword static in the header before the method name.		
Static methods can only access or change the values of static variables.		
Static methods do not have a this reference and are unable to call non-static methods.		
Data encapsulation is a technique in which the implementation details of a class are kept hidden from the user.		
The keywords public and private affect the access of classes and methods.		
The keyword private restricts access to the declaring class, while the keyword public allows access from classes outside the declaring class.		
Access to behaviors can be internal or external to the class. Therefore, methods can be designated as either public or private.		
When an actual parameter is a primitive value, the formal parameter is initialized with a copy of that value. Changes to the formal parameter have no effect on the corresponding actual parameter.		
Local variables can be declared in the body of methods. These variables
may only be used within the method and cannot be declared to be public or private.		
When there is a local variable with the same name as a static variable, the variable name will refer to the local variable instead of the static variable.		
Formal parameters and variables declared in a method can only be used within that method.		
Static methods are called using the dot operator along with the class name unless they are defined in the enclosing class. 		
Static variables are used with the class name and the dot operator, since they are associated with a class, not objects of a class.		
A method signature for a method without parameters consists of the method name and an empty parameter list.		
Non-void methods return a value that is the same type as the return type in the signature. To use the return value when calling a non-void method, it must be stored in a variable or used as part of an expression.		
Non-void methods return a value that is the same type as the return type in the signature. To use the return value when calling a non-void method, it must be stored in a variable or used as part of an expression.		
A method call interrupts the sequential execution of statements, causing the program to first execute the statements in the method before continuing. Once the last statement in the method has executed or a return statement is executed, flow of control is returned to the point immediately following where the method was called.		
A method signature for a method with parameters consists of the method name and the ordered list of parameter types.		
Values provided in the parameter list need to correspond to the order and type in the method signature.		
Methods are said to be overloaded when there are multiple methods with the same name but a different signature.		
Non-void methods with parameters receive values through parameters, use those values, and return a computed value of the specified type.		
A non-void method returns a single value. Its header includes the return type in place of the keyword void.		
In non-void methods, a return expression compatible with the return type is evaluated, and a copy of that value is returned. This is referred to as “return by value.”		
When the return expression is a reference to an object, a copy of that reference is returned, not a copy of the object.		
When an actual parameter is a reference to an object, the formal parameter is initialized with a copy of that reference, not a copy of the object. If the reference is to a mutable object, the method or constructor can use this reference to alter the state of the object.		
Passing a reference parameter results in the formal parameter and the actual parameter being aliases. They both refer to the same object.