Question: Write a method echo that accepts a String as a parameter and returns a string with each word repeated twice. Assume each word is preceded

Write a method echo that accepts a String as a parameter and returns a string with each word repeated twice. Assume each word is preceded by a single space and at least one space exists.Sample below:

System.out.println(echo("hello there java world")); // hello hello there there java java world world

System.out.println(echo("1 2 3 4 5")); // 1 1 2 2 3 3 4 4 5 5 }

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!