Java-String Concatenation

String Concatenation To join two String objects to form a new, single string you use the + operator, just as you have been doing with the argument to the println() method in the program example thus far. Program Program Source class Javaapp { public static void main(String[] args) { System.out.println(“hajsof”+”java”+”tutorial”); } }

Extracting Character and Concatenation

Java-Extracting Character and Concatenation

Extracting Character The charAt( ) method provides the character at the specified index position. The starting value of the index in the case of a string is zero. For example, in the following example, the character at position 3 in the string “ABCDEFG” is ‘D’. Thus, the str1.charAt(3) method will return the character ‘D’. Example: … Read more…

string concatenation

Java-String Concatenation

String Concatenation Java defines one operator for string object such as “+”, it is used to concatenate two string. For example, in the following program, the value of the variable ‘date’,’month’ and ‘year’ is being converted to a string that represents this value as a decimal digit character. This is prompted by the fact that it … Read more…