filmov
tv
Learn Java Programming - String Class Tutorials concat(...)

Показать описание
In this tutorial I will talk about the concat method. The concat method returns a new String instance that is the concatenation of the value of the current string instance plus the string value of the parameter. There is a common misperception that the concat method and the + (concatenation operator) are the same thing. While they are similar in the way they work, the + operator actually uses the StringBuilder class .append() method to do its work. The concat method works like this:
String apples = "Apples ";
String oranges = "& Oranges";
String apples = "Apples ";
String oranges = "& Oranges";