Lesson A4
Next: Writing Methods...Lesson Overview: It was recognized long ago that programming is best accomplished by working with smaller sections of code that are connected in very specific and formal ways. Programs of any significant size should be broken down into smaller pieces. Classes can be used to create objects that will solve those smaller pieces. We determine what behaviors these objects will perform. These behaviors of the objects are called methods.
Values passed in to a method when it is called.
Methods that return the value of an attribute.
Definitions of object behavior, or what an object can "do", defined in the class.
Values that define what can be passed into a method, defined on method declaration.
A keyword telling the compiler that the value immediately following is to be outputted by the method.
Refers to the area of a program in which an identifier is valid and has meaning.
Methods that allow other classes to set the value of an attribute.
The information needed to call a method: (of the method) name, how many parameters it has, the type of each parameter, and the order of those parameters.
Key words that define when a field, method, constructor or class can be accessed.
The public access modifier makes a field, method, constructor or class accessible in any other class.
The private access modifier makes a field, method, constructor or class accessible only from the class it is declared in.
The protected access modifier makes a field, method, constructor or class accessible only in subclasses and classes in the same package.
When there is no access modifier, a field, method, constructor or class is has private package access which means it is accessible only in classes in the same package.