Write a Java program to concatenate a given string to the end of another string.

Java Programming Language String in java (Article) String in java (Program)

723

Program:

public class Exercise {

    public static void main(String[] args)
    {
        String str1 = "PHP Exercises and Python Exercises";
        String str2 = "and";
        System.out.println("Original String: " + str1);
        System.out.println("Specified sequence of char values: " + str2);
        System.out.println(str1.contains(str2));
    }
}

Output:

Original String: PHP Exercises and Python Exercises
Specified sequence of char values: and
true
Press any key to continue . . .

Explanation:

None

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.