on 06-02-2008 1:55 PM
Hello!
I have a problem: I have in my method()
String t = results[2];
String d = results[0];
with return t + d;
And I want to import it to other method1(). How can I do that??
Thanks!!
Hello,
It is not really clear what is your problem: compilation error, runtime error, other?
return (string1+string2) works perfectly for two strings. For example, the following code will be compiled with no issues:
String myMethod(String [] res) {
if (res == null || res.length < 2) return null;
return res[0] + res[1];
}
void myMethod2() {
String [] res = new String [] {"Hello ", "Sue!"};
String x = myMethod (res);
System.out.println(x);
}
The fragment will print "Hello, Sue!"
Does it work for you?
Kind regards,
Tsvetomir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.