1/17
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
object
a specific instance of a class
overloaded method
a method with the same name (but different parameters) as another method
public
can be used outside of a class
method
what an object can do (or how it can behave)
field (instance variable)
properties of a class
private
can only be used inside of a class
constructor
creates a new object
Class(public or private)
public
field(public or private)
Private
constructor(public or private)
Public
Method(public or private)
Public
Requirements for a constructor?
- Same name as class
- no return type
- no parameters
- Each constructor of a class must have a different set of parameters
- A class can have 0, 1, or several constructors.
- creates the object and usually initializes its field values.
- if no constructor is defined, then a default constructor will be invoked which has no parameters and sets all fields to default values (0 or null).
- ex: Student()
Requirements for a method?
- return type required
- modifier(optional)
- has the word public or private, the return type, the method name, and a list of parameters.
- The keyword void in a method header means that the method doesn't return anything.
- ex: getAge() -- accessor
reserved words
- predefined identifiers that have a specific meaning in the language syntax
- ex: int, double, new
Void
Used before a method if the method returns no value. In other words, it simply prints or manipulates values, but it doesn't actually return a value of its own.
Object-oriented programming
In Object-oriented programming, or OOP, all computations are carried out with objects.
Procedural programming
a list of instructions which tells the computer what to do step-by-step. Procedural programming is based on procedures, often called routines or subroutines. A procedure contains a series of steps to be carried out.
Accessor
- An accessor is a special method that allows methods outside of a class to have access to the class's private fields.