concatenation is not working as intended
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
hello again,
User inputs certain variables for the story, the problem I am having is the concatenation is not working as intended. the story part with the + parts all come back with an error. I thought I had it correct but obviously i don't.
Any help on the story part? please? thank you.
User inputs certain variables for the story, the problem I am having is the concatenation is not working as intended. the story part with the + parts all come back with an error. I thought I had it correct but obviously i don't.
Any help on the story part? please? thank you.
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Please read ItDoesntWorkIsUseless. Then follow the guidelines - i.e. tell us what the exact error is.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Adrian Martinez
Greenhorn
Posts: 27
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
this is the error i receive when i try to compile.
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Have a read through Oracle's Strings Tutorial paying particular attention to the "Concatenating Strings" section.
See if you can see where you're going wrong.
See if you can see where you're going wrong.
Tim Driven Development | Test until the fear goes away
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Try sorting out the first error and recompiling. You have missed something out. If you sort out one error, many of the others will probably vanish.
I suggest you learn about formatted printing, which is neater than catenating multiple strings with +.
You should be compiling after writing 5 to 10 lines. Writing 40 lines before trying to compile something is too much. As you see, you get lots of errors and might not be able to work out where they occurred. In this case, they were all in the same place, but that is unusual.
I suggest you learn about formatted printing, which is neater than catenating multiple strings with +.
You should be compiling after writing 5 to 10 lines. Writing 40 lines before trying to compile something is too much. As you see, you get lots of errors and might not be able to work out where they occurred. In this case, they were all in the same place, but that is unusual.
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
another tip...look closely at the code you posted. You see how a string literal is blue (i.e. anything INSIDE double quotes). Here is your line in question:
Do you see how towards the end, things get "off"? I'd suggest removing most of this line, and add pieces back in a bit at a time, recompiling and testing often - for this line alone, i'd probably recompile/test between 5-10 times as I add a little more each time.
Do you see how towards the end, things get "off"? I'd suggest removing most of this line, and add pieces back in a bit at a time, recompiling and testing often - for this line alone, i'd probably recompile/test between 5-10 times as I add a little more each time.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
posted 11 years ago
I can see at least 6 things wrong with this line of code. You need to put a + between ALL the terms.
Edit : It seems I'm a day or so too slow!
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Adrian Martinez wrote:
I can see at least 6 things wrong with this line of code. You need to put a + between ALL the terms.
Edit : It seems I'm a day or so too slow!
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Check where you missed the + signs. The below line of code is compiling fine.
System.out.println("There was once a person named " + name + " who lived in city " + city + ". At the age of " + age + " " + name + " went to college at " + college + ". " + name + " graduated and went to work as a " + profession + ". Then adopted an animal " + animal + " named " + pet + " . They both lived happily ever after." );
Thanks,
Aakash
System.out.println("There was once a person named " + name + " who lived in city " + city + ". At the age of " + age + " " + name + " went to college at " + college + ". " + name + " graduated and went to work as a " + profession + ". Then adopted an animal " + animal + " named " + pet + " . They both lived happily ever after." );
Thanks,
Aakash
Adrian Martinez
Greenhorn
Posts: 27
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Thank you again, i couldn't figure it out .
| She'll be back. I'm just gonna wait here. With this tiny ad: The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |









