import java.util.*; /** Extra: Pinon toteutus LinkedList -luokkaan pohjautuen */ class Pino extends LinkedList { public Pino() { super(); } // Lisäys public boolean push(Object o) { return super.add(o); } // Poisto public Object pop() { if (super.size() >= 1) return super.remove(super.size()-1); else return null; } } public class StackTesti { public static void main(String args[]) { Pino pino = new Pino(); pino.push("Pekka"); pino.push("Maija"); System.out.println(pino.pop()); pino.push("Jaana"); System.out.println("pinossa alkiota: " + pino.size()); System.out.println(pino.pop()); System.out.println(pino.pop()); System.out.println(pino.pop()); } }