title: Main Method with int, Object and String [] args
body: <p>I got the below code from internet and even though there are 3 main methods, if I run the app from command prompt:</p>
  
  <pre><code>java MainTest 1 2 3
  </code></pre>
  
  <p>I would get the output:</p>
  
  <blockquote>
    <p>String main 1</p>
  </blockquote>
  
  <pre><code>public class MainTest {
  
      public static void main(int [] args) {
          System.out.println("int main " + args[0]);
      }
      public static void main(Object[] args) {
          System.out.println("Object main " + args[0]);
      }
  
      public static void main(String[] args) {
          System.out.println("String main " + args[0]);
      }
  
  }
  </code></pre>
  
  <ul>
  <li><p>Is there any scenario where more than 1 main method is needed in the same class? </p></li>
  <li><p>I have not used yet the main method with <code>int</code>, <code>Object [] args</code>? Is that even possible? I thought it was only possible with <code>String[] args</code>.</p></li>
  <li><p>I was expecting getting an error message at runtime. Why I did not get any error when the application ran? Does it mean that the parameters passed are always parsed to <code>String</code> and Java gets the main method that suits best?</p></li>
  </ul>
  
  <hr>
  
  <p>Thanks a lot!!</p>