Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem # 4 ( Code 2 ) Write a public static method called print 2 which returns a String and has one String parameter: str
Problem #Code
Write a public static method called print which returns a String and has one String parameter: str This method does exactly the same thing as print from the previous question. The method returns a String where each line has a new letter from starting with the last letter first and adding new letters from right to left You can assume a nonnull 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 print code and you must redevelop the logic with the new given restrictions.
tableSample calls,Output of the callsSystemout.printlnprintComputer ;tablererter
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started