Calling Methods

PHOTO EMBED

Wed Sep 21 2022 19:41:29 GMT+0000 (Coordinated Universal Time)

Saved by @cruz #javascript

public class Store {
  // instance fields
  String productType;
  
  // constructor method
  public Store(String product) {
    productType = product;
  }
  
  // advertise method
  public void advertise() {
		System.out.println("Selling " + productType + "!");
    System.out.println("Come spend some money!");
  }
  
  // main method
  public static void main(String[] args) {
    Store lemonadeStand = new Store("Lemonade");
    Store Cookies = new Store("Oreos");

    lemonadeStand.advertise();
    Cookies.advertise();
  }
}
content_copyCOPY