Tuesday, 17 November 2020

Program in Java to accept 2 Words and concatenate and display them.

import java.util.*;

public class Concat

{

public static void main(String args[])

{

Scanner in=new Scanner(System.in);

String a,b;

System.out.println("Enter 2 Words");

a=in.next();

b=in.next();

System.out.println(a.concat(b)); //We can also write it as System.out.prinln(x+b);

}

}



No comments:

Post a Comment

Java Program to count the total number of characters in a string

 //Java Program to count the total number of characters in a string import java.util.*; public class CountChars {     public static void mai...