- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to Concatenate String.
The concat() method of the String class concatenates the specified string to the end of this string.
Example
import java.lang.*; public class StringDemo { public static void main(String[] args) { // print str1 String str1 = "self"; System.out.println(str1); // print str2 concatenated with str1 String str2 = str1.concat(" learning"); System.out.println(str2); // prints str3 concatenated with str2(and str1) String str3 = str2.concat(" center"); System.out.println(str3); } }
Output
self self learning self learning center
- Related Articles
- Java Program to concatenate a String and Integers
- Java Program to concatenate Integers and a String
- Concatenate null to a string in Java
- Java Program to Concatenate Two Arrays
- Concatenate string to an int value in Java
- C++ program to concatenate a string given number of times?
- C++ Program to Concatenate Two Strings
- How to concatenate lists in java?
- How to concatenate multiple string variables in JavaScript?
- Concatenate string with numbers in MySQL?
- How to concatenate two strings so that the second string must concatenate at the end of first string in JavaScript?
- Python program to concatenate Strings around K
- Java Program to format a string
- Java Program to Print a String
- Java Program to Reverse a String

Advertisements