1 class Bicycle {
2 int cadence = 0;
3 int speed = 0;
4 int gear = 1;
5 void changeCadence(int newValue) {
6 cadence = newValue;
7 }
8 void changeGear(int newValue) {
9 gear = newValue;
10 }
11 void speedUp(int increment) {
12 speed = speed + increment;
13 }
14 void applyBrakes(int decrement) {
15 speed = speed - decrement;
16 }
17 void printStates() {
18 System.out.println("cadence: "+cadence+" speed: "+speed+" gear: "+gear);
19 }
20 }
21 class BicycleDemo {
22 public static void main(String[ ] args) {
23 // Cria dois objetos Bicycle diferentes
24 Bicycle bike1 = new Bicycle( );
25 Bicycle bike2 = new Bicycle( );
26 // Invoca os métodos desses objetos
27 bike1.changeCadence(50);
28 bike1.speedUp(10);
29 bike1.changeGear(2);
30 bike1.printStates();
31
32 bike2.changeCadence(50);
33 bike2.speedUp(10);
34 bike2.changeGear(2);
35 bike2.changeCadence(40);
36 bike2.speedUp(10);
37 bike2.changeGear(3);
38 bike2.printStates( );
39 }
40 }
Considerando o código Java acima, julgue os itens a seguir, acerca da programação orientada a objetos.