Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

passing data

Posted on 1998-08-28
4
Medium Priority
?
228 Views
Last Modified: 2012-05-04
I have code that looks like this:
String xxx="";
new Create_Html(buf1[j]);
//xxx = new Create_Html.Create_Html(buf1[j]);

I have tried both of the above neither works, i'm just
tring to pass data to code called Create_Html.
I get the following error message:

javac Create_List.java
Create_List.java:94: Incompatible type for constructor. Can't convert java.lang.String to java.lang.String[].
new Create_Html(buf1[j]);
                    ^
1 error

What am I doing wrong? I've done this with other code
with no problems. Can any one show me the way?

Thanx!
0
Comment
Question by:afsac
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
msmolyak earned 400 total points
ID: 1222862
Look like the class Create_Html has a constructor which expects a String, not an array. Why are you passing an array?
0
 
LVL 5

Expert Comment

by:msmolyak
ID: 1222863
Sorry, it's the other way around. The constructor expects an array of strings, but you are passing an element of that array. Change it to
  new Create_Html(buf1);
0
 
LVL 3

Expert Comment

by:sailwind
ID: 1222864
Uhmm.. no msmolyak. The constructor is expecting an array, not a string.
try doing  new Create_Html(buf1);  instead.
0
 

Author Comment

by:afsac
ID: 1222865
THANX!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This video teaches viewers about errors in exception handling.
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question