Consider the following class definition.
public class Animal {
private String species;
private int age;
private double weight;
public Animal(String animalSpecies, int animalAge, double animalWeight) {
species = animalSpecies;
age = animalAge;
weight = animalWeight;
}
public void eat() {
weight += 5;
}
public double getWeight() {
return weight;
}
}
Assume that the following code segment appears in a class other than Animal.
java
Copy code
Animal dog = new Animal("Dog", 3, 15);
dog.eat();
System.out.println(dog.getWeight());
What is printed as a result of executing the code segment?