Mapa mental
Java OOP Language
Conteúdo do mapa
Java OOP Language
Class
- Object
- Fields
- AKA: Attributes or Variables
- Methods
- AKA: Actions or Functions
- Method and Field Names: camelNamingConvention
- returnType methodName (listOfArguments)
- Main is a special method that only has to be in one class. This method allows the class containing it to be invoked.
- returnType methodName (listOfArguments)
- Return Type of a Method can be a Primitive, an Object, or Void
- Primitive Data Types include: the boolean, byte, char, short, int, long, float, and double
- A value with two choices: true or false
- An 8-bit signed two's complement integer, that has a minimum value of -128 and a maximum value of 127 (inclusive)
- A single character enclosed in single quote marks like this: char myCharacter = 'g'
- A 32-bit signed two's complement integer, which has a minimum value of 2^-31 and a maximum value of 2^31
- An Integer
- A 64-bit two's complement integer, which has a minimum value of -263 and a maximum value of 263^-1
- A 16-bit signed two's complement integer, that has a minimum value of -32,768 and a maximum value of 32,767 (inclusive)
- A double type variable is a 64-bit floating data type which can represent fractional as well as whole values. Contains up to 15 digits in total, including those before and after the decimal point.
- The float data type is a single-precision 32-bit IEEE 754 floating point which has an unlimited value range. It should never be used for precise values, such as currency.
- The return type Void means that the method returns nothing
- Primitive Data Types include: the boolean, byte, char, short, int, long, float, and double
- AKA: Actions or Functions
- AKA: Instances
- To create an object use "new" followed by the constructor of the class to be instantiated
- To call a method or access a field use "objectReference.methodName" and "objectReference.fieldName"
- A Reference Variable refers to an object
- Reference Variables with no value have a "null" value
- To test if a Reference Variable is null, use the "==" operator
- Fields
- Class Names: PascalNamingConvention
- class className { [class body] }
- Constructor
- Sometimes called a constructor method (looks like a method)
- No return value, not even void
- Must have same name as class
- constructorName (listOfArguments) { [constructor body] }
- Constructor Arguments can be used to initialize fields in Objects
- Object