• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

Java code help!

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to write a program that reads the first name and last name from the user as two seperate inputs and concantenates the first name and a last name seperated by a space. Displasy in a message dialogue the concantenated name?
Can anyone please help me on this one. Any help is greatly appreciated!!!
Thank You~
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chad,
How about the code snippet below?

No challenge,
Manfred.
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chad, post what have you written so far. Let's see where you may be going wrong.
 
chad steinacker
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Manfred Leonhardt:
Hi Chad,
How about the code snippet below?

No challenge,
Manfred.


when I tr and run it I get an error 21 class or interface expeected for the line that begins catch( IOException....
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code doesn't describe a class. It is to be within a method that is part of a class.
 
chad steinacker
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
im sorry but im not following what youre saying?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the error you said you were getting, I would guess that you are either trying to use the code example outside of a class definition or that you have a missing and/or extra "{" or "}" somewhere.
The try-catch construct must be inside of a method definition that is inside of a class definition - the framework for which is in my previous post.
If you are still having difficulties getting the code snippet from Manfred to compile and run, if you were to post exactly what you are trying, I'm sure someone will help point out any mistakes.
Good Luck.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic