title: Cannot find symbol while using .repeat() method in Java (The code is working in Netbeans)
body: <p>I'm solving a problem in Java and it works perfectly in Netbeans without any error message but the website's compiler where I upload my code drops me the following error:</p>
  <pre><code>Compile error:  Main.java:16: error: cannot find symbol
              String finalString = newString.repeat(n + 1);
                                            ^
    symbol:   method repeat(int)
    location: variable newString of type String
  </code></pre>
  <p>My code:</p>
  <pre><code>Scanner sc = new Scanner(System.in);
  
          String myString = sc.nextLine();
          int n = sc.nextInt();
          String finalString = &quot;&quot;;
  
          for (int i = 0; i &lt; myString.length(); i++) {
              String newString = myString.substring(n + 1, myString.length());
  
              finalString = newString.repeat(n + 1);
  
          }
          System.out.println(finalString);
      }
  }
  </code></pre>
  <p><strong>Sample input:</strong><br/>
  Hello<br/>
  2</p>
  <p><strong>Sample output:</strong><br/>
  lololo</p>