Home » Developer & Programmer » JDeveloper, Java & XML » concatenate strings to print/display vertically (Java 1.4.2_06 XP)
icon5.gif  concatenate strings to print/display vertically [message #494748] Wed, 16 February 2011 22:56 Go to next message
Messages: 20
Registered: July 2010
Location: india
Junior Member

I created a sample application in java which concatenates three strings and displays the result in a final string.

Check the code:-
public class conCat
  public static void main (String[] args)
    String Message1 = "This ";
    String Message2 = "is a Sample ";
    String Message3 = "Application";
    String Message = Message1 + Message2 + Message3;

C:\>javac C:\javaprog\conCat.java

C:\>java conCat
This is a Sample Application

And the three strings are concatenated to the final string "Message" only.
How to concatenate them vertically?

The required output is :

is a sample 

Kindly provide me the solution.
Re: concatenate strings to print/display vertically [message #494774 is a reply to message #494748] Thu, 17 February 2011 01:36 Go to previous message
Michel Cadot
Messages: 68499
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Either println each string or add "\n" at the end of each message.

This is an Oracle site not a Java one.
If you have strict Java question, not related to Oracle you should find a better forum.

Previous Topic: Can we use JSF and AJAX in Oracle iStore Aplication
Next Topic: transfer data via xml
Goto Forum:

Current Time: Fri Sep 22 00:57:21 CDT 2023