X989: Concatenating Strings 2

The method below takes an int parameter n. Implement the methodd so that it returns a string containing the numbers from 1 to n concatenated together.

For example:

  • If n is 3, this method would return "123"
  • If n is 10, this method would return "12345678910"

Note: Use a numeric for loop, and think about what value you want to start with, as well as what value you want to end with. Your answer will be simpler if you do not follow the normal pattern for the starting value and loop condition.

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.