Files
G4G0-1/Semester 1/Programming 1/Week 3/Week 3 Programming 1 - Understanding Class Definitions.md
2024-01-15 20:14:10 +00:00

52 lines
921 B
Markdown

## Lecture 1 (11:00)
## Lecture 2 (14:00)
### Modifiers
```java
private
public
```
- These are two examples of modifiers in java. Will cover more in chapter 3
### Mutator Vs Accessor Methods
```java
public void changeColour( int newColour )
{
colour = newColour;
draw();
}
```
- An example of a **mutator** method. Since the method **mutates** an integer, and does not return a value.
```java
public int getPrice()
{
return price;
}
```
- This would be an example of an **accessor** method. Since this accesses a value and outputs to a location.
### Formal Vs Actual Parameter
```java
public void changeSize( int newDiameter )
```
- newDiameter is the **formal** parameter
- The value of newDiameter is the **actual** parameter
### Good Practices
- Vertically align braces, since it allows for better error checking
### Extra Stuff
- Homework Wednesday
- Name everything exactly, marking is automated