title: How to return class - type in a method
body: <p>I have a class </p>
  
  <pre><code>public class Engine {
  
      Double engineSize;
      public Engine(){
          this.engineSize = 1.0;
      }
      public Double getEngineSize() {
  
          return engineSize;
      }
  }
  </code></pre>
  
  <p>I have another class:</p>
  
  <pre><code>public class ModelT {
  
      public Engine getEngine() {
  
          return null;
      }}
  </code></pre>
  
  <p>Now I want to pass this test: </p>
  
  <pre><code>@Test
  
  public void shouldHaveTheCorrectEngineSize(){
      assertThat(modelT.getEngine().getEngineSize(), is(1.0));
  }
  </code></pre>
  
  <p>I have the difficulty how can I return the Engine type in a method, I tried several ways but knowledge is limited because I am beginner to java.. Could you please tell me how could i do this? and what is the name of concept that i could further read on.. </p>