Showing posts with label concat(). Show all posts
Showing posts with label concat(). Show all posts

Saturday, 15 June 2013

program in java to concatinate to string OR use of concat() string function

import java.io.*;

public class stringConcat
{
    public static void main(String []args)
    {
        String str,str1,str2;
        try
        {
            DataInputStream cin=new DataInputStream(System.in);
            System.out.println("Enter first String ");
            str=cin.readLine();
            System.out.println("Enter another String ");
            str1=cin.readLine();
            System.out.println("Your entered strings are  = "+str+" and "+str1);
            str2=str.concat(str1);
            System.out.println("concatinated string is :- "+str2);
        }
        catch(Exception e)
        {
            System.out.println(e);
        }
    }
}