12 September 2018

Java Program for concatenation of two strings

//Java Program for concatenation of two strings
import java.util.*;
class concatenate
   {
  public static void main(String args[])
    {
    String a="Welcome to ";   
    String b="Copymyprograms blog";
    System.out.println("String a :"+a);
    System.out.println("String b :"+b);
    String c=a+b;//Java automatically adds two strings using + operator
    System.out.println("After concatenation \n String c :"+c);
    }
 }

Output will be similar to this :

A similar program to this :

 Java program to compare two strings

No comments:

Post a Comment

To convert from Upper case to lowercase(A to a)

//converting from Upper to lower(A to a) import java.util.*; class case { public static void main(String args[]) { System.out.pr...