school/java/old/java1/exam/another_wut.java

17 lines
326 B
Java
Raw Permalink Normal View History

2021-01-20 06:57:22 -05:00
public class Widget {
private int inStock;
public Widget() {
inStock = 10;
}
public void addInventory(int amt) {
inStock = inStock + amt;
}
public static void main(String [] args){
Widget blueWidget = new Widget();
Widget greenWidget = new Widget();
blueWidget.addInventory(15);
greenWidget.addInventory(5);
}
}