Pizza.java Source code

Java tutorial

Introduction

Here is the source code for Pizza.java

Source

import java.util.HashMap;
import java.util.Map;

class Pizza {
}

class CheesePizza extends Pizza {
}

class VeggiePizza extends Pizza {
}

public class Main {

    public static void main(String... args) {
        Map<String, Pizza> pizzaStock = new HashMap<String, Pizza>();

        pizzaStock.put("cheese", new CheesePizza());
        pizzaStock.put("veggie", new VeggiePizza());
        System.out.println(pizzaStock);
    }
}