X30: repeatEnd

Write a function in Java that implements the following logic: Given a string and an int n, return a string made of n repetitions of the last n characters of the string. You may assume that n is between 0 and the length of the string, inclusive.

Your Answer:

x
 
1
public String repeatEnd(String str, int n)
2
{
3
    
4
}
5

Feedback

Your feedback will appear here when you check your answer.