Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Condertmscode public void agePenguins(){ int middleAge = 3; int youngAge = middleAgel; int oldAge = middleAge+1; ArrayLi5tlt;Penguingt; penguins =...

The code is in Java. Why are the answers below correct? How do you find what objects and object references are active? And what is the difference between the two? Thanks!

  • Attachment 1
  • Attachment 2
  • Attachment 3
Confldertmscode public void agePenguins(){int middleAge = 3;int youngAge = middleAge—l;int oldAge = middleAge+1;ArrayLi5t<Penguin> penguins = new ArrayList<>():Penguin archie = new Penguin();archie.setAge(youngAge); //this sets the Penguin's agepenguins.add(archie):penguins.add(archie);penguins.add(archie):Penguin newbie = penguins.get(2): //this returns the 3rd element of the ArrayListnewbie.setAge(oldAge);System.out.println(archie.getAge()): //this prints the Penguin's age
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question