 Assistant Professor from Department of Electronics from Walchin Institute of Technology, Sallapur. So, today we are going to have a session on Introduction to String Objects and Methods in Java. After the end of this session, student will be able to create string objects, concatenation of string using methods. Let us see with the string objects. How to create a string object? There are two ways to create string object. First is by using the string lateral method and second by using the new keyword. Let us see both the methods one by one. First by using the string lateral method. The string lateral is created by using the double codes. So for example, string is the data type, S is the string object we are going to create equal to double codes welcome. So this double code welcome is the string we are going to create using the string object the object name is S which is the variable name. Second by using the new keyword. The syntax is string is the data type, S is the object name equal to the keyword new followed by the data type string in the brackets welcome. The welcome string is stored in the string object variable S by using the new keyword. So next is string concatenation. In Java string concatenation forms a new string that is combination of multiple strings. So you can concatenate or you can join multiple strings together in Java. So to concatenate there are two ways in Java. First by using the plus operator. So you can add the two or more strings using the plus operator and second by using the inbuilt concant method. So let us see in detail both these methods one by one. String concatenation by plus operator. Java string concatenation plus operator is used to add the strings. String concatenation operator provides new string. So new string is created which will append the second operator onto the end of the first operator. So string S1 S2 if you want to add the both the strings S1 S2 you will be requiring the third string S3 will be S1 plus S2 means S2 will join at the end of the string S1. Second is string concatenation by concant method. String concatenate method concatenates the specified string to end of the first string. The syntax is string concant and in the bracket the second string. Let us try write a program to create string object by using string lateral method by the new keyword. Let me open the command prompt. Let me open the editor any editor you can take I am going to open the notepad. So write a program to create the string object first using the string lateral method. So public public class so I will write the class name as string now the main function public static void main string ARGS. Now let us create the string object using the string lateral method. First will be the data type string followed by the string object S equal to in the double codes you are going to specify the string. So I say the string is waltz in just print the string object by the output statement system dot out dot print ln. So just print this string object S and complete the code save the file using the class name that is string string and the extension Java I am storing it on desktop go to the command prompt you need to change the directory to desktop command is cd desktop. Now Java C is the command you are going to call the Java compiler Java C string dot Java the byte code is successfully generated now run the byte code Java string. So you have printed the string waltz in using the string lateral method. Go back to the editor write the program now for the creating the string object using the new keyword data type string S equal to keyword new followed by the data type again and in the bracket you have the waltz in string. Now just print the system dot out dot print ln just print the object S control S save the file go back to the command prompt Java C call the compiler string dot Java the byte code is successfully generated run the code Java string so you can see again the string is printed waltz in with the help of the string string object is created with the keyword new. Let us try the second program writer program to concatenate two strings which two strings string one should be waltz in string two should be the institute. Go back to the notepad I am going to edit on the same file string S equal to I am going to concatenate waltz in an institute using the plus operand. So waltz in plus the second I am going to give space over here so that it looks the different words institute I am going to concatenate both this using the plus operand. So just print system dot out dot print ln and print the string object S so save the file go back to the command prompt Java C string dot Java byte code is generated Java string so you can see waltz in plus institute so we have used the plus operand and we have concatenated the waltz in an institute. So now concatenate the strings using the concant method string S1 equal to I am going to declare now waltz in and different string institute I am going to declare these two as a separate string so waltz in space and the second string S2 equal to double codes institute these are the two separate strings now so I will be requiring the third string which will store the concatenation in the third variable so S3 now I am going to use the concant command that is S1 dot concant in the bracket S2. So this will join the S2 which is the institute at the end of the string S1 which is nothing but waltz in so you will get the third string as waltz in space institute because we have given here space so just print the statement system dot out dot print ln and just print the third string object which is S3 save the file ctrl s go back to the command from java c string dot java bytecode is successfully generated java string so you can see now the waltz in institute which were both different strings S1 was waltz in S2 was institute now third string is generated using the concant S1 and S2 so S2 is joined at the end of the string S1 so this is how we have done with the concantination of the strings what is input parameter for string object pause the video and answer the question answer to the question is strings is the parameter input parameter for the string object references are taken from java a beginners guide code java to volume one fundamentals java to the complete reference thank you.