Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/codersales/java-oop-tutorial

java-oop-tutorial | preparatory for ArrayList tutorial
https://github.com/codersales/java-oop-tutorial

2024 java msc oop tutorial

Last synced: about 4 hours ago
JSON representation

java-oop-tutorial | preparatory for ArrayList tutorial

Awesome Lists containing this project

README

        

# java-oop-tutorial
java-oop-tutorial | preparatory for ArrayList tutorial

## Content

### Input

```bash
$ javac Bicycle.java
```

### Output

```bash
cadence:0 speed:0 gear:1
```

### Code (basically except it's BicycleModified.java not Bicycle.java)

```java
class BicycleModified {int cadence = 0;
int speed = 0;
int gear = 1;
void changeCadence(int newValue) {cadence = newValue;}
void changeGear (int newValue) {gear = newValue;}
void speedUp (int increment){speed += increment;}
void applyBrakes (int decrement){speed -= decrement;}
void printStates () {System.out.println("cadence:" + cadence
+ " speed:" + speed
+ " gear:" + gear);}
public static void main(String[] args) {
BicycleModified bicycle1 = new BicycleModified();
bicycle1.printStates();}}
```

## References

java oop tutorial [Objects, Classes, Interfaces, Packages, and Inheritance](https://dev.java/learn/oop/)