<<< Using the this keyword | Index | Creating an object in one or two statements >>> |
public class Product { // the instance variables private String code; private String description; private double price; // constructors public Product() { this( "unknown", "unknown", 0.0 ); } public Product(String code, String description, double price) { this.code = code; this.description = description; this.price = price; } }
<<< Using the this keyword | Index | Creating an object in one or two statements >>> |