Thanks Mohammad, managed to get things running but a few queries(pardon my ignorance).
1.Why didnt the complier recognize the below code as a constructor?
2.if i want to use the getAction() in ,let say, hamster,how can i go about doing that?
This time 1 error....errrrr any idea how to solve this?
23.java:37: error: constructor GoldFish in class GoldFish cannot be applied to given types;
owner.pets[2]=new GoldFish();
^
required: String
found: no arguments
reason: actual and formal argument lists differ in length
1 error
My issue is i cant get the arrays correct,with abstract class.Can some one highlight to me the errors in class Example1.I want to create 2 extra pets (iguana & hamster) but i am getting it wrong.
below are the errors from my complier
23.java:37: error: constructor GoldFish in class GoldFish cannot be applied to given types;
owner.pets[2]=new GoldFish();
^
required: String
found: no arguments
reason: actual and formal argument lists differ in length
23.java:38: error: constructor Dog in class Dog cannot be applied to given types;
owner.pets[3]=new Dog("Hamster");
^
required: no arguments
found: String
reason: actual and formal argument lists differ in length
23.java:39: error: constructor Dog in class Dog cannot be applied to given types;
owner.pets[4]=new Dog("Iguana");
^
required: no arguments
found: String
reason: actual and formal argument lists differ in length
3 errors