title: Why are two class files created on compiling?
body: <p>I knew that when a class has an inner class then this class will be compiled to two class files. Today I have codes as below</p>
  
  <pre><code>public class GenericDeserializer {
  
      public static void main(String[] args) {
          String cityPageLoadJson = "{\"count\":2,\"pageLoad\":[{\"id\":4,\"name\":\"HAN\"},{\"id\":8,\"name\":\"SGN\"}]}";
          Type type = new TypeToken&lt;GenericResult&lt;City&gt;&gt;() {
          }.getType();
          Gson gson = new GsonBuilder().setPrettyPrinting().create();
          GenericResult&lt;City&gt; cityPageLoad = gson.fromJson(cityPageLoadJson, type);
          for (City city : cityPageLoad.getPageLoad()) {
              System.out.println(gson.toJson(city));
          }
      }
  
  }
  </code></pre>
  
  <p>Although the above one has no inner class, java compiler still creates two class files:</p>
  
  <pre><code>GenericDeserializer.class
  GenericDeserializer$1.class
  </code></pre>
  
  <p>Using <code>Java Decompiler</code> tool, I see content of the second</p>
  
  <pre><code>package net.tuandn.training.lesson.gson;
  
  import com.google.gson.reflect.TypeToken;
  import net.tuandn.training.model.City;
  import net.tuandn.training.model.GenericResult;
  
  final class GenericDeserializer$1 extends TypeToken&lt;GenericResult&lt;City&gt;&gt;
  {
  }
  </code></pre>
  
  <p>Could anybody please explain why this class is created?<br>
  And when are multiple class files created on compiling?</p>
  
  <p>Thank a lot!</p>