Java Program to show usage of this pointer using Order Pizza Program

Program

class OrderPizza
{
	String pname;
	int quantity;
	double cost;
	orderPizza(String pname, int quantity, double cost)
	{
		this.pname = pname;
		this.quantity = quantity;
		this.cost = cost;
		show();
	}
	void show()
	{
		System.out.println("Pizza Name: " + this.pname);
		System.out.println("Quantity: " + this.quantity);
		System.out.println("Bill Amount: " + this.cost);
	}
}
public class ThisPizzaDemo
{
	public static void main(String[] args)
	{
		orderPizza m = new orderPizza("Cheeze Burst", 2, 450.00);
	}
}

Output

Pizza Name: Cheeze Burst
Quantity: 2
Bill Amount: 450.0