title: What is the functional difference between these two definitions?
body: <pre class="lang-java prettyprint-override"><code>// in PingPongMessage.java
  public class PingPong {
    
    public static final class Ping { } 
  
  } 
  
  // in PingActor.java
  public class PingActor extends AbstractBehavior&lt;PingPong.Ping&gt; {
  
      public static Behavior&lt;PingPong.Ping&gt; create() {
          return Behaviors.setup(context -&gt; new PingActor(context));
      }
  
      private PingActor(ActorContext&lt;PingPong.Ping&gt; context){
          super(context);
      }
  
      @Override
      public Receive&lt;PingPong.Ping&gt; createReceive() {
          return newReceiveBuilder().onMessage(PingPong.Ping.class, this::onPingMsg).build();
      }
  
      private Behavior&lt;PingPong.Ping&gt; onPingMsg() {
          System.out.println(&quot;Ping!&quot;);
          return this;
      }
  
  }
  </code></pre>
  <p>vs.</p>
  <pre class="lang-java prettyprint-override"><code>// in PingActor.java
  
  public class PingActor extends AbstractBehavior&lt;PingActor.Ping&gt;{
  
      public static final class Ping {
  
      }
  
      public static Behavior&lt;Ping&gt; create() {
          return Behaviors.setup(context -&gt; new PingActor(context));
      }
  
      private PingActor(ActorContext&lt;Ping&gt; context){
          super(context);
      }
  
      @Override
      public Receive&lt;Ping&gt; createReceive() {
          return newReceiveBuilder()
                  .onMessage(Ping.class, this::onPingMessage).build();
      }
  
      private Behavior&lt;Ping&gt; onPingMessage(Ping message){
          System.out.println(&quot;Ping!&quot;);
          return this;
      }
  }
  </code></pre>
  <p>I am trying to understand the relationship between <code>Ping</code> and <code>PingActor</code> in both the cases. In my opinion both are doing the same thing, but in one case <code>PingPong.Ping</code> is defined inside <code>PingActor</code> and in the other case <code>PingPong</code> is another class outside of it. Obviously they are not the same because the second example seems to compile, but the first does not.</p>
  <p>The compiler error is -
  <code>Inferred type 'M' for type parameter 'M' is not within its bound; should extend 'com.lightbend.akka.sample.PingPong.Ping</code> seen in <code>Receive&lt;PingPong.Ping&gt; createReceive()</code></p>