22 lines
625 B
Java

/**
* this class is also declared with the public keyword to make it accessible
* outside of the current file
*/
public class Car {
// define the fields
public String model = "";
public String manufacturer = "";
// create the method print_info()
public void print_info() {
System.out.println("Car Information:");
/**
* To access fields of the current object the this keyword is used. It is
* possible to omit that keyword, but it's recommended to be used anyways.
*/
System.out.println("- manufacturer: " + this.manufacturer);
System.out.println("- model: " + this.model);
}
}