Q:

Java Program to Append(Concatenate) one string to another string

belongs to collection: Java String Solved Programs

0

Java Program to  concatenate or to append one string to another string in Java Programming, you have to ask to the user to enter the two string and start concatenating one string into the other using the concat() function.

In this program ,we are going to use in-built functions for appending one string to another.Below is the source code of the program u want……

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

SOURCE CODE ::

import java.util.Scanner;

public class Append_string
{
   public static void main(String args[])
   {
      String str1, str2;
      Scanner scan = new Scanner(System.in);
 
      System.out.print("Enter First String : ");
      str1 = scan.nextLine();
      System.out.print("Enter Second String : ");
      str2 = scan.nextLine();
      
      System.out.print("Concatenating String 2 into String 1...\n");
      str1 = str1.concat(str2);
          
      System.out.print("String 1 after Concatenation is " +str1);
   }
}
 
 

OUTPUT ::

 
Enter First String : Codez
Enter Second String : Club
Concatenating String 2 into String 1...
String 1 after Concatenation is CodezClub

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Java String Solved Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a Java Program to Swap Strings using temp va... >>
<< Write a Java Program to Copy String into Another S...