title: Can a main method in Java return something?
body: <p>I went through an interview recently and they ask me two questions in core Java.</p>
  
  <p>Q 1.</p>
  
  <blockquote>
    <p>Can we write a java class with:</p>
  
  <pre><code>public static int main(String[] args){
       System.out.println("Hello");
  </code></pre>
  </blockquote>
  
  <p>I answered: No. The compiler won't compile it as it is expecting the return type of <code>main</code> to be <code>int</code>, though we can overload it.</p>
  
  <p>Q 2: The next question I was unable to answer.</p>
  
  <blockquote>
    <p>Write a program so that your Java <code>main</code> method could return something.</p>
    
    <p>I.e. how can you make <code>public static void main([] args)</code> to return something?</p>
  </blockquote>
  
  <p>Can any body help me to answer this?</p>