title: Beginner String Manipulation
body: <p>Why does the following code not work for the question here? <a href="http://codingbat.com/prob/p101475" rel="nofollow">http://codingbat.com/prob/p101475</a></p>
  
  <pre><code>public String frontTimes(String str, int n) {
    if (str.length() &lt; 3) {
       String front = str;
    } else {
       String front = str.substring(0, 3);
    }
    String copies = "";
  
    while (n &gt; 0) {
       copies = copies + front; 
       n = n - 1;
    }
  
    return copies;
  
  
  }
  </code></pre>
  
  <p>I really don't understand the "front cannot be resolved" error I'm getting</p>