return value - Passing method argument through ternary operator in java -
    code:   public class foo {      static void test(string s){         system.out.println("string called");     }      static void test(int s){         system.out.println("int called");     }      public static void main(string[] args) throws exception {          test(5>8? 5:8);         // line 1         test(5>8? "he":"ha");   // line 2          test(5>8? 5:"ha");      // line 3          system.out.println(5<8? 5:"ha"); //line 4     } }   when execute code following error @ line 3   foo.java:24: error: no suitable method found test(int#1)                 test(5>8? 5:"ha");              // line 3                 ^   using similar type in ternary operator not give error. using different types gives error method call test(5>8? 5:"ha");  works call system.out.println(5<8? 5:"ha");   when add overloaded method static void test(object s){} , //line 3  compiles.   can please explai...