//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
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