File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Java code help! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java code help!" Watch "Java code help!" New topic
Author

Java code help!

chad steinacker
Greenhorn

Joined: Apr 30, 2002
Posts: 7
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~
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Chad,
How about the code snippet below?

No challenge,
Manfred.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Chad, post what have you written so far. Let's see where you may be going wrong.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
chad steinacker
Greenhorn

Joined: Apr 30, 2002
Posts: 7
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....
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
The code doesn't describe a class. It is to be within a method that is part of a class.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
chad steinacker
Greenhorn

Joined: Apr 30, 2002
Posts: 7
im sorry but im not following what youre saying?
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
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.
 
 
subject: Java code help!