Skip to content

Commit 412021f

Browse files
committed
Adding getters and setters
1 parent 742ca99 commit 412021f

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

oop-in-java-vs-python/Car.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ public int getYear() {
3636
return year;
3737
}
3838

39+
/**
40+
* setYear changes Car's year
41+
*/
42+
public void setYear(int year) {
43+
this.year = year;
44+
}
45+
3946
/**
4047
* getWheels returns the number of wheels
4148
*/

oop-in-java-vs-python/Device.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
public interface Device {
77

88
/**
9-
* getVoltage returns the current battery voltageS
9+
* getVoltage returns the current battery voltage
1010
*/
1111
int getVoltage();
1212
}

oop-in-java-vs-python/Vehicle.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,24 @@ public String getColor() {
2525
return color;
2626
}
2727

28+
/**
29+
* setColor changes the Vehicles color
30+
*/
31+
public void setColor(String color) {
32+
this.color = color;
33+
}
34+
2835
/**
2936
* getModel returns the Vehicles model
3037
*/
3138
public String getModel() {
3239
return model;
3340
}
3441

42+
/**
43+
* setModel changes the Vehicles model
44+
*/
45+
public void setModel(String model) {
46+
this.model = model;
47+
}
3548
}

0 commit comments

Comments
 (0)