diff --git a/src/main/java/myPkg/casting/Casting.java b/src/main/java/myPkg/casting/Casting.java index 06ab30c..9a99cdf 100644 --- a/src/main/java/myPkg/casting/Casting.java +++ b/src/main/java/myPkg/casting/Casting.java @@ -1,16 +1,39 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package myPkg.casting; - -/** - * - * @author laura - */ -public class Casting { - - public static void main(String[] args) { - } -} \ No newline at end of file +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package casting; +import java.util.*; +/** + * + * @author addav + */ +public class Casting { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + // TODO code application logic here + + ArrayList list = new ArrayList<>(); + list.add(new Circle(1.0)); + list.add(new Date()); + list.add("String"); + list.add(new Rectangle(2.0, 3.0)); + + for(int i = 0; i list; + + @Override + public boolean isEmpty(){ + return super.size() == 0; + } + + public int getSize(){ + return super.size(); + } + + public Object peek(){ + return super.get(getSize()-1); + } + + public Object pop(){ + Object a = super.get(getSize()-1); + super.remove(getSize()-1); + return a; + } + + public void push(Object a){ + super.add(a); + } + + @Override + public String toString(){ + return "Stack: "+super.toString(); + } +}