Question

don't use System.exit() please

don't use System.exit() please

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

Explanation:

Here is the code which has the method appendNTimes in bold taking a string original and the integer n.

It returns the String concatenated n times recursively.

feel free to comment if you need any help!

Code:

public class Main
{
public static String appendNTimes(String original, int n)
{
if(n==0)
return "";
  
return original + appendNTimes(original, n-1);
  
}

   public static void main(String[] args) {
       System.out.println(appendNTimes("cat", 3));
   }
}

Output:

catcatcat Program finished with exit code 0 Press ENTER to exit console.

PLEASE UPVOTE IF YOU FOUND THIS HELPFUL!
PLEASE COMMENT IF YOU NEED ANY HELP!

Add a comment
Know the answer?
Add Answer to:
don't use System.exit() please
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • don't use system.exit() please

    don't use system.exit() please

  • use your own words, don't copy and paste, don't use handwriting, please. i need references please...

    use your own words, don't copy and paste, don't use handwriting, please. i need references please Discuss the applications of Binary Logistic Regression in Clinical Research using the case study given in the(Application of Binary Logistic Regression in Clinical Research) in a brief manner with a maximum length of two pages use your own words, don't copy and paste, don't use handwriting, please. i need references please use your own words, don't copy and paste, don't use handwriting, please. i...

  • Please, i need Unique answer, Use your own words (don't copy and paste). *Please, don't use...

    Please, i need Unique answer, Use your own words (don't copy and paste). *Please, don't use handwriting. Please, i need Unique answer, Use your own words (don't copy and paste).Please, i need Unique answer, Use your own words (don't copy and paste).Please, i need Unique answer, Use your own words (don't copy and paste).Please, i need Unique answer, Use your own words (don't copy and paste).Please, i need Unique answer, Use your own words (don't copy and paste).Please, i need...

  • use your own words, don't copy and paste, don't use handwriting, please. i need references please...

    use your own words, don't copy and paste, don't use handwriting, please. i need references please * Select an environmental health problem, in Saudi community. Outline of Environmental health report (1-2 pages) 1 The environmental health problem 1.1 What is the problem ? 1 point 1.2 Where is that problem? I point 1.3 When the problem happened? 1 point 2 Causes of the environmental health problem 2 points 3 Health effects of the problem Use references , 2 points 4...

  • ** use your own words, don't copy and paste, don't use handwriting, please. i need your...

    ** use your own words, don't copy and paste, don't use handwriting, please. i need your references URL Link please** ** use your own words, don't copy and paste, don't use handwriting, please. i need your references URL Link please** Q: Find out a food technical regulation and standards for any selected food items in Kingdom of Saudi Arabia (example- pickled fruits, pickled cucumber). Discuss the health effects about the food additives used on them   // i need more details and...

  • Please, i need Unique answer, Use your own words (don't copy and paste) *Please, don't use...

    Please, i need Unique answer, Use your own words (don't copy and paste) *Please, don't use handwriting. * i need References APA style Q1. What are the General purposes of communication?

  • Please, i need Unique answer, Use your own words (don't copy and paste). *Please, don't use...

    Please, i need Unique answer, Use your own words (don't copy and paste). *Please, don't use handwriting. How do Internet technologies help companies in building a customer-focused business?

  • Please, i need Unique answer, Use your own words (don't copy and paste). *Please, don't use...

    Please, i need Unique answer, Use your own words (don't copy and paste). *Please, don't use handwriting. * i need References APA style . What are the major food groups for diet? (1 Point)

  • use your own words, don't copy and paste, don't use handwriting, please. i need references please...

    use your own words, don't copy and paste, don't use handwriting, please. i need references please * Select an environmental health problem, in Saudi community. please DON'T talk about Desertification Outline of Environmental health report (1-2 pages) 1 The environmental health problem 1.1 What is the problem ? 1.2 Where is that problem? 1.3 When the problem happened? 2 Causes of the environmental health problem 3 Health effects of the problem Use references , 4 Solutions / mitigation measures Use...

  • use your own words, don't copy and paste, don't use handwriting, please. i need references please...

    use your own words, don't copy and paste, don't use handwriting, please. i need references please * Select an environmental health problem, in Saudi community. please DON'T talk about Desertification Outline of Environmental health report (1-2 pages) 1 The environmental health problem 1.1 What is the problem ? 1.2 Where is that problem? 1.3 When the problem happened? 2 Causes of the environmental health problem 3 Health effects of the problem Use references , 4 Solutions / mitigation measures Use...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT