title: Still getting NullPointerException even if using Optional<>
body: <p>I am trying to use Optional&lt;> to keep an check on nullpointexception and incase it happens then some otherthing to print.
  (<a href="https://www.oracle.com/technetwork/articles/java/java8-optional-2175753.html" rel="nofollow noreferrer">https://www.oracle.com/technetwork/articles/java/java8-optional-2175753.html</a>)</p>
  
  <p>I am setting soundcard to null, and still i am getting nullpointerexception, but i want to avoid it with optional. </p>
  
  <p><strong>Main Class (Computer)</strong></p>
  
  <pre><code>import java.util.Optional;
  
  public class Computer {
      public Optional&lt;SoundCard&gt; getSoundcard() {
          return soundcard;
      }
  
      public void setSoundcard(Optional&lt;SoundCard&gt; soundcard) {
          this.soundcard = soundcard;
      }
  
      private Optional&lt;SoundCard&gt; soundcard = null ;
  
  
      public static void  main(String[] args)
      {
           Optional&lt;Computer&gt; computer = Optional.of(new Computer());;
  
  
          String verion = computer.flatMap(Computer::getSoundcard)
              .flatMap(SoundCard::getUsb)
              .map(USB::getVersion)
              .orElse("Unknown");
          System.out.println(verion);
      }
  }
  </code></pre>
  
  <p><strong>Another class SoundCard</strong></p>
  
  <pre><code>import java.util.Optional;
  
  public class SoundCard {
  
      public Optional&lt;USB&gt; getUsb() {
          return usb;
      }
  
      public void setUsb(Optional&lt;USB&gt; usb) {
          this.usb = usb;
      }
  
      private Optional&lt;USB&gt; usb = null;
  }
  </code></pre>
  
  <p><strong>Another Class (USB)</strong></p>
  
  <pre><code>public class USB {
  
      public String getVersion() {
          return version;
      }
  
      public void setVersion(String version) {
          this.version = version;
      }
  
      private String version;
  }
  </code></pre>
  
  <p>Any hint or help is welcome :)</p>