-
June 1st, 2011, 07:21 PM
#1
[RESOLVED] How to use these Constructor parameters?
I am having difficulty trying to get passed this bump in the road in a program I am trying to build, mainly regarding an overloaded Constructor and an objects creation. Here it is:
The Constructor:
Whale(String name, int age, String[] whaleType, String[] fishOrigin){
this.name = name;
this.age = age;
this.whaleType = whaleType;
this.fishOrigin = fishOrigin;
}
The Object Creation:
Whale w = new Whale("Erwin", 37, "Blue Whale", "Ocean-fish");
There is a compiler error stating that I need a String, int, String, String, but I need them to be String, int, String[], String[]. Is this possible? Can anyone offer any guidance to this, it's been a frustrating few hours!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|