21 lines
589 B
Java
Raw Normal View History

2020-05-03 15:12:03 +02:00
/**
* this class is also declared with the public keyword to make it accessible
* outside of the current file
*/
public class Car {
2020-05-03 15:12:54 +02:00
// define the fields
2020-05-03 15:12:03 +02:00
public String model = "";
public String manufacturer = "";
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);
}
}