Question: Problem # 4 ( Code 2 ) Write a public static method called print 2 which returns a String and has one String parameter: str

Problem #4(Code 2)
Write a public static method called print2 which returns a String and has one String parameter: str. This method does exactly the same thing as print1 from the previous question. The method returns a String where each line has a new letter from str starting with the last letter first (and adding new letters from right to left). You can assume a non-null String will be passed in for str. For this method you should use a nested loop. As for library methods, you can only use the String methods: length and charAt. If you have a System. out. println in your code, you are not writing the code correctly. No need for a main. Obviously, you cannot just call your print1 code and you must re-develop the logic with the new given restrictions.
\table[[Sample calls,Output of the calls],[System.out.println(print2("Computer")) ;,\table[[r],[er],[ter],[I
 Problem #4(Code 2) Write a public static method called print2 which

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!