Classes: Constructors

PHOTO EMBED

Wed Sep 21 2022 02:44:18 GMT+0000 (Coordinated Universal Time)

Saved by @cruz #javascript

public class Store {
  
  // new method: constructor!
  public Store() {
    System.out.println("I am inside the constructor method.");
  }
  
  // main method is where we create instances!
  public static void main(String[] args) {
    System.out.println("Start of the main method.");
    
    // create the instance below
    Store lemonadeStand = new Store(); 
    // print the instance below
    System.out.println(lemonadeStand);
  }
}
content_copyCOPY