Answered step by step
Verified Expert Solution
Link Copied!

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 #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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions

Question

Describe enchanted objects.

Answered: 1 week ago

Question

List and describe three contingency leadership theories.

Answered: 1 week ago