I'm a newbie to Java. Can you tell me why I can't print a proper result of this code?
public Main() {
Pizza pizza = new Pizza("yes", "Cheese", 20000);
System.out.println(pizza);
}
I have created the class pizza like this.
package pitjahat;
public class Pizza {
private String name;
private String topping;
private Integer price;
public Pizza(String name, String topping, Integer price) {
super();
this.name = name;
this.topping = topping;
this.price = price;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTopping() {
return topping;
}
public void setTopping(String topping) {
this.topping = topping;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
}
and the result that comes out when I run is like this
pitjahat.Pizza@52af6cff