Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/codersales/java-oop-tutorial
- Owner: CoderSales
- License: mit
- Created: 2024-03-24T23:41:51.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-25T04:20:32.000Z (8 months ago)
- Last Synced: 2024-03-25T05:23:11.775Z (8 months ago)
- Topics: 2024, java, msc, oop, tutorial
- Language: Java
- Homepage: https://dev.java/learn/oop/
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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/)