The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

Re: simple java help needed

I think what norms trying to say is that you seem to have missed sort of fundamental information about methods, and if you're ever going to get better this is some really important stuff to know.
I think you've missunderstood the assignment btw. You dont want a method that declares boo and then creates booboo. You want a method that takes in a string, and returns (string + string). If your method would work, and be passed the value feet, it should return feetfeet. But yours would return booboo.

Re: simple java help needed

for number two I have, but it's wrong:
public char doubleWord(String x)
{
x="boo";
x=x+x;
Return(x);
}

Hello Miss Concfused

Here is an example of what I like posts requesting help to look like.

First post your code, either the whole thing, or the specific problem area. You did so in this case, you just need to use the code tags.

public char doubleWord(String x){
x="boo";
x=x+x;
Return(x);
}

Then state the result of you code. Will it compile. If it will, then what does it result in, and why is that unexpected to you.
In this case:
My code wont compile, and when I got it to compile it returned "booboo" rather than the input concatenated input string.

As for you method, there are a couple if things wrong.
-Your return type is char. I cant see why you have chosen that, it should be String.
-return is a keyword in java, and it is case sensitive. Return != return. It should be return here. Also the item returned does not go in brackets.
The logical problem in the method:
-Your local variable x of type String is overwritten by x="boo". So no matter what you chose as input the result will be "boo" + "boo" = "booboo".
The concatenation works as it should, so with above fixes it should be fine.