title: "Cannot return a value with void result type" error
body: <p>The following code comes from <a href="https://stackoverflow.com/a/38301932/6542063">this</a> answer</p>
  
  <pre><code>try {
          // get all the interfaces
          List&lt;NetworkInterface&gt; all = Collections.list(NetworkInterface.getNetworkInterfaces());
          //find network interface wlan0  
          for (NetworkInterface networkInterface : all) {
              if (!networkInterface.getName().equalsIgnoreCase("wlan0")) continue;
          //get the hardware address (MAC) of the interface    
              byte[] macBytes = networkInterface.getHardwareAddress();
              if (macBytes == null) {
                  return "";
              }
  
  
              StringBuilder res1 = new StringBuilder();
              for (byte b : macBytes) {
                  //gets the last byte of b
                  res1.append(Integer.toHexString(b &amp; 0xFF) + ":");
              }
  
              if (res1.length() &gt; 0) {
                  res1.deleteCharAt(res1.length() - 1);
              }
              return res1.toString();
          }
      } catch (Exception ex) {
             ex.printStackTrace();
      }
  </code></pre>
  
  <p>I get error <code>Cannot return a value with void result type</code> on those 2 lines: <code>return "";</code> and <code>return res1.toString();</code> I put the code inside <code>public void onStart()</code> How do I fix this, and can you tell me the cause of this problem?</p>