Fill This Form To Receive Instant Help
Homework answers / question archive / Run the following code to check how String class Methods work, discuss with tutor, if you need explanation of any method
Run the following code to check how String class Methods work, discuss with tutor, if you need explanation of any method. Make changes and try different variations. String myString ="Is NSW Lockdown really over!"; String s1= "NSW"; String s2= "nsw"; String s3 = " Welcome to NSW "; System.out.println("Char at index 2(third char): " + myString.charAt(2)); System.out.println("After Concat: "+ myString.concat("-for sure-")); System.out.println("Checking equals with case: " +s2.equals(s1)); System.out.println("Checking Length: "+ myString.length()); System.out.println("Replace function: "+ myString.replace("Is", "was")); System.out.println("SubString of myString: "+ myString.substring(8)); System.out.println("SubString of myString: "+ myString.substring(8, 12)); System.out.println("Converting to lower case: "+ myString.toLowerCase()); System.out.println("Converting to upper case: "+ myString.toUpperCase()); System.out.println("Triming string: " + s3.trim()); System.out.println("searching s1 in myString: " + myString.contains(s1)); System.out.println("searching s2 in myString: " + myString.contains(s2));