title: ExitCodes bigger than 255, possible?
body: <p>If yes, on which operating system, shell or whatever?</p>
  
  <p>Consider the following java program (I'm using java just as an example, any language would be good for this question, which is more about operation systems):</p>
  
  <pre><code>public class ExitCode {
      public static void main(String args[]) {
          System.exit(Integer.parseInt(args[0]));
      }
  }
  </code></pre>
  
  <p>Running it on Linux and bash, it returns always values less equal 255, e.g. (<code>echo $?</code> prints the exit code of the previous executed command)</p>
  
  <pre><code>&gt; java ExitCode 2; echo $?
  2
  
  &gt; java ExitCode 128; echo $?
  128
  
  &gt; java ExitCode 255; echo $?
  255
  
  &gt; java ExitCode 256; echo $?
  0
  
  &gt; java ExitCode 65536; echo $?
  0
  </code></pre>
  
  <hr>
  
  <p>EDITED: the (only, so far) answer below fully  explain what happens on UNIXes. I'm still wondering about other OSes.</p>