+ 2
Is it possible to use a return method for a char?
So I have: static char letter(char abr1, char abr2) { return abr1; } My code works, but it can only get abr1, how do I get it to return both? I tried using & and + to "return abr1 + abr2", but it says it cannot convert from int to char.
4 Answers
+ 2
convert your method into String instead of char since it'll be a string that's returned. Now just create the variable in the method String s = "" + abr1 + abr2; Have to have the double quotations because it adds the characters into them to form the string. Then return s;
0
I realized something I was doing wrong, I was trying to assign 2 chars into 1 variable, so I need to find a way to convert to 2 chars into a string...
0
yes
0
yes you are able to use a return method for a char.