title: Java - error: cannot find symbol
body: <p>i've a problem with an exercise of Thinking in Java. This is the code (this is the solution of the exercise) . </p>
  
  <pre><code>// object/StorageTest.java
  // TIJ4 Chapter Object, Exercise 6, page 90
  // Write a program that includes and calls the storage() method defined as a
  // code fragment in this chapter.
  
  public class StorageTest {  
      public static void main(String[] args) {
          class StoreStuff {
              int storage(String s) {
                  return s.length() * 2;
              }   
          }
          StoreStuff x = new StoreStuff();
          System.out.println(x.storage("hi"));        
      }
  }
  </code></pre>
  
  <p>When i compile it, i've this error:</p>
  
  <blockquote>
    <p>C:\Users\Ivan\Desktop>javac StorageTest.java StorageTest.java:5:
    error: cannot find symbol
                                    return (s.lenght()*2);
                                             ^   symbol:   method lenght()   location: variable s of type String 1 error</p>
  </blockquote>
  
  <p>I don't understand why this happens.</p>