19 lines
565 B
Java
19 lines
565 B
Java
|
/**
|
||
|
* this class is also declared with the public keyword to make it accessible
|
||
|
* outside of the current file
|
||
|
*/
|
||
|
public class Car {
|
||
|
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);
|
||
|
}
|
||
|
}
|