I have a dog class type list which contains many objects of that class(many dogs each new object) with constructor input. For example list Dogs with type dog contains dog with weight, age, length: dog(30,5,100), dog(40,6,120). I want the program to print out all dogs with age 5.
I would think something like that, but cant figure it out.
public Dog askDogs(int age){ //user enters requested age for(Dog d:Dogs){ if(d.askAge()==age){ //I have method askAge() in dog class which returns integer } } return Dogs; }