title: A RECURSIVE method accepts two parameters: a String s and an int n
body: <p>(I actually don't know how to write this code, I checked internet find it maybe look like this, but when I run it, it didnt work. </p>
  
  <p>For example, input ("College",2). It should output ("College","College"). But it shows cannot read. 
  I just don't know how to solve this problem.
  Please teach me how to write this code.</p>
  
  <p>-------Write a RECURSIVE method called printStr that accepts two parameters: a String s and an int n.  This method should return a String containing the String s written n times, separated by a space each time.  Assume n >= 1.</p>
  
  <p>For example, calling printStr("Lehman", 2) should return "Lehman Lehman", and calling printStr("The Bronx", 4) should return "The Bronx The Bronx The Bronx The Bronx".</p>
  
  <p>Call your class Homework5_2.  In the main method, call your method printStr several times to test it.</p>
  
  <p>import java.util.Scanner;</p>
  
  <p>public class Homework5_2 {</p>
  
  <pre><code>public static void main(String[] args) {
      Scanner keyboard=new Scanner(System.in);
      int n = 0;
      String s = args[1];
  
      System.out.print(printStr(s,n));
  
  }
  
  public static String printStr(String s, int n){
      if (n==0) {
          return "";
      }
      return s + printStr(s, n - 1);
      }
  </code></pre>