






















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!























Bakery Class Is the bakery open/closed? Buy bread Buy bagel Buy muffin Buy coffee …
Type
Interface
public class Bakery {
}
public boolean closed ; int numBagels ;
Optional access modifier (more on this later)
Data member type
Data member name
Optional access modifier (More on this later)
Name of method
return type (may be void)
public int^ getBagelCount {
}
Method code: local variables and statements
()
Optional parameters
Car myCar;
myCar = new Car();
Car myCar = new Car();
public static void main(String args[]) {
Car myCar = new Car(); myCar.vin = "123567890ABCDEF"; myCar.numLiters = 2; myCar.horsepower = 195; myCar.year = 2008; myCar.changeColor("Black"); System.out.println("Car is colored: " + myCar.color); System.out.println("Car is " + (2011 - myCar.year) + " years old");
}