|
-
Aug 28th, 2008, 06:36 AM
#1
Thread Starter
Junior Member
Constructor error
Hi, I get the following error when I go to compile my test class:
cannot find symbol - constructor MyString(java.lang.String,int)
This is my tester code (obviously no where near complete):
Code:
public class TestMyString
{
public static void main(String[] args)
{
MyString myString1 = new MyString("a", 1);
}
}
This is my constructor:
Code:
public MyString(char array, int length)
{
//constructor creates new char array
data = new char[length];
for (int i = 0; i < length; i++)
{
data[i] = array;
}
}
Everything I've tried has failed so I've come here for help
-
Aug 28th, 2008, 07:06 AM
#2
Re: Constructor error
"a" is a String
'a' is a charachter (char)
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Aug 28th, 2008, 07:25 AM
#3
Thread Starter
Junior Member
Re: Constructor error
wow, I feel stupid now thanks
-
Aug 29th, 2008, 05:23 AM
#4
Re: Constructor error
 Originally Posted by gabbo
wow, I feel stupid now  thanks 
don't worry, if it's any consolation, everybody starts that way.
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
|