Please post your code correctly using code or highlight tags which are explained near the top of this link.
Welcome to the Java Programming Forums
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.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Please post your code correctly using code or highlight tags which are explained near the top of this link.
If I had a method called int getFood() { }
What should the return type be?
Wishes Ada xx
If to Err is human - then programmers are most human of us all.
"The Analytical Engine offers a new, a vast, and a powerful language . . .
for the purposes of mankind."
— Augusta Ada Byron, Lady Lovelace (1851)
What resources are you using to learn Java? Surely they have pointed out the reasons for every item in a method's signature. Please reread your textbook, notes, or refer to online resources to learn about the method's signature, including the return type.
i want to change the int into a string and i have a specific string for the output
You have answered your own question.i want to change the int into a string
Wishes Ada xx
If to Err is human - then programmers are most human of us all.
"The Analytical Engine offers a new, a vast, and a powerful language . . .
for the purposes of mankind."
— Augusta Ada Byron, Lady Lovelace (1851)
please, i am having trouble and it is saying that i can't do what i'm trying to do, it is saying that the return type is void
Look at the data type you are trying to return from
the method - what type is that? What type have you
declared your method to return? Do they match?
Wishes Ada xx
If to Err is human - then programmers are most human of us all.
"The Analytical Engine offers a new, a vast, and a powerful language . . .
for the purposes of mankind."
— Augusta Ada Byron, Lady Lovelace (1851)
i don't know...
--- Update ---
i didn't set a specific one
How much Java have you learnt, or been taught? Like
Greg said previously, all these things are basic terminologies
that apply to just about every programming language. Not
being rude here - just wondering how far into the book/course
you are at the moment.
The bottom line is, if you, the programmer do not understand what
and why you have written - it is almost impossible for anyone else to.
Look at the sort of data type it is - is it a numeric, a string, a decimal?
Does that give you a clue?
Wishes Ada xx
If to Err is human - then programmers are most human of us all.
"The Analytical Engine offers a new, a vast, and a powerful language . . .
for the purposes of mankind."
— Augusta Ada Byron, Lady Lovelace (1851)
it is numeric to string,
btw i am on the fourth chapter in the book
Sorry I am confused now...
Is that the data you want to change from and to or
is that the type of data you want the method to return?
Wishes Ada xx
If to Err is human - then programmers are most human of us all.
"The Analytical Engine offers a new, a vast, and a powerful language . . .
for the purposes of mankind."
— Augusta Ada Byron, Lady Lovelace (1851)
i want have int changed into a string so that i is one instead of 1
Will that have any effect on the return type error you were getting previously?
Is it me or are we going round in circles in this thread? I am certain you asked
this exact question near the beginning. Take a look at previous posts, it has
been answered before.
Wishes Ada xx
If to Err is human - then programmers are most human of us all.
"The Analytical Engine offers a new, a vast, and a powerful language . . .
for the purposes of mankind."
— Augusta Ada Byron, Lady Lovelace (1851)
This thread is being closed for the following reasons:
1. No progress has been made
2. The OP is not posting code in code/highlight tags
3. The conversation has deteriorated to recursion with no exit
4. The OP is not participating in the solution; not demonstrating effort.
@lucas29: You are welcome to begin a new thread but PLEASE observe the following hints - your own personal "Starting a thread 101:"
1. Give the new thread a descriptive title (Suggestion for this topic: "Help changing numerals to English").
2. Describe your assignment in as much detail as needed for someone to understand what you're trying to do.
3. Post the commented code you've written so far in code or highlight tags (explained near the top of this link). Preferably, the posted code will be compilable and runnable.
4. Ask specific questions, post error messages you need help with, and/or post sample runs copied from your console that demonstrate how to duplicate the problems and errors you require help to fix.
New threads that don't observe these guidelines will not be accepted. Once you've posted as I've described above and you receive responses:
1. Read the responses completely and try to apply the advice given.
2. If you do not understand the advice given or how to apply it, ask questions until you do understand (return to step 1). Otherwise, continue to Step 3.
3. If you still need help after applying the advice given, post updated code and ask NEW questions, NOT the same ones over and over again.
4. Do not post the same message over and over again, as in "i want to change the int into a string."
When you deviate from the above recipe, the new thread will be closed, and you will not be invited to return. This or future action is not intended to be mean or an indication that we don't like you but because we want you to get the help you need, and you're not getting it here. You have to be a contributing participant in the process. We can't do it for you.
If you are simply unable to move forward, I highly recommend you take advantage of the instructor's office hours or use the TAs as much as possible. It's important that they see you're struggling and need extra help.
Good luck!
Thread closed.