CSE 110 Lab 3: Objects and classes in Java Lab Exercise: Complete this portion of the lab during your lab session. 1. String Manipulation: The following program illustrates the use ofsome of the methods in the String class. Study the program to see what it is doing. String Manips.j java Test several methods for manipulating string objects import j ava util Scanner: public class string Manips public static void main (String args) string phrase new string Programming is fun string int phraselength; number of phrase string int middle Index index of the character in the string first Half: first half of the phrase string string second alfa second half of the phrase string switched string a new phrase with original halves compute the length and middle index of the phrase Statement phrase Length middle Index phraselergth 2a get the substring for each half of the phrase statement 2 phrase substring (0, middleIndex)1 statement 3 second Half phrase substring (middaeIndex, phrasetength) a concatenate the firstHal at the end of the secondlalt 4 switched Phrase secondRalf.concat (firstHalf): statement print information about the phrase system. .Prantin original phrase phrase) System out -printin the phrase phraselangt system out printin (\"Length characte middle Index System oat printin (\"Index of the middle \"Character at the middle index 5 phrase (middle Index) statement printin (\"Switched n witched?hraseli system out, printin system ou 
Statement 1 : phrase.length() ;It gives the length of the string referred to by phrase reference variable . Or the number of characters in the string \"Programming is fun.\" The value is assigned to phraselength variable .
 Not very clear from the picture , should return 19 .
 Statement 2 : It gives a part of the string \"Programming is fun.\" , starting from the first character till the middle index character , middle index character . If the length of string is 19 the middle index is 19/2 = 9 .This refers to character at the 10th position n.
 \"Programmin\" .
 Statement 3 :It gives a part of the string \"Programming is fun.\" , starting from the middle index character till the end of the string , .This refers to character from 10th position to end.\"Programmin\" is assigned to firsthalf.
 Interesting thing to note is 19th is not a possible index but it still does\'nt throw an error . As it is allowed by Java API .
 \"ng is fun.\"
 Statement 4 : It appends the firstHalf to the secondHalf string . Giving \"ng is fun.Programmin\"
 Statement 5 : This returns the charater in phrase string ( calling string ) at the index passed as parameter . \"n\"