Question: In this method, create a new string variable called coolWord that points to the string literal SuperCaliFragilisticExpialiDocious. Then print out the following output using System.out.println().

In this method, create a new string variable called coolWord that points to the string literal "SuperCaliFragilisticExpialiDocious". Then print out the following output using System.out.println(). A (get this letter from coolWord, and capitalize it) 3 (number of occurrences of the letter a in coolWord) SuperDocious (print 2 subparts of coolWord together) -1 (as a result of trying to find the letter w in coolWord) supercalifragilisticexpialidocious3 (make coolWord be all lowercase, and concatenate 3 at the end of it)

Use ONLY the string class methods. Do not simply use "a", "-1", etc. as the argument for System.out.println(). Use concatenation to print out the last two strings. Use indexOf to print out the numbers. */ String coolWord = "SuperCaliFragilisticExpialiDocious"; /* ***************Task 2C**************** In this method, use the completed reverse method to print the reversed versions, followed by the non-reversed versions, of the three string literals pointed by test1, test2, and test3. */ String test1 = "cyber security"; String test2 = "internet of things"; String test3 = "cloud computing"; //write code below, should occupy at most six lines //print reversed versions... //print non-reversed versions... /* ******************Task 2D ******************** further test the reverse method, by calling it again from the playWithStrings() method, providing the following input, and checking that you get the expected output below: Input Correct output "Banana" "ananaB" "Solstice" "ecitsloS" "Top Secret" "terceS poT" "caaaaaab" "baaaaaac" "cab" "bac" */

} /* ***************Task 2B**************** A skeleton for the reverse method is written below. Complete the skeleton. Hint: use substring and concatenation. */ /** * Reverses a string. * * @param toReverse The string to reverse * @return The reversed string */ public static String reverse(String toReverse) { String reversed = toReverse; //code goes here.... return reversed; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!