Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. public class Animais {
  2.  
  3. public static void main(String[] args) {
  4.  
  5. ArrayList<Animal> animais = new ArrayList();
  6.  
  7. Mamifero cao = new Mamifero("Cao");
  8. animais.add(cao);
  9. Reptil camaleao = new Reptil("Camaleao");
  10. animais.add(camaleao);
  11. Ave aguia = new Ave("Aguia");
  12. animais.add(aguia);
  13. Peixe sardinha = new Peixe("Sardinha");
  14. animais.add(sardinha);
  15.  
  16. for(int i=0; i<animais.size(); i++) {
  17. animais.get(i).desloca();
  18. }
  19. }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement