CSS font stacks & developer FAQs with Web standards
Site navigation below

One of hundreds of answers available with our premium content service.

Part answer, see below for more

A: An example of inheritance using the extends keyword would be the java.util.Stack class that extends the Vector class to provide a last-in-first-out stack of Objects. The Stack class uses the same underlying storage facilities provided by the superclass and adds its own, so it “is a” type of Vector and behaves like a specialised “wrapper” around the Vector class. The Stack class adds a boolean empty() method, peek(), pop() and push() methods to manage the stack contents and a search() method to find the index of a given object. All the original methods of the Vector class remain and the Stack can be cast to a Vector as necessary.

… full answer hidden

Click for full answers

Premium members click below for full answer
Can you show examples of Java inheritance?

Premium service benefits

Your premium content subscription is a single payment that gives you:

Home · Web fonts · Font stacks · FAQs · Java · CSS · Javascript · HTML · Site manager