I am trying to understand method overloading and I'm not able to understand the reason for the following code error in the following example

```
public class OverLoading_OverRiding {
     public static void main(String[] args) {
        OverLoading_OverRiding o = new OverLoading_OverRiding();
        o.sum(5, 5);
    }

    void sum(int i, long j) {   }
    void sum(long i, int j) {   }
}

```

I am getting an error: 

> 
> The method sum(int, long) is ambiguous for the type
>  OverLoading\_OverRiding.
> 
> 
> 

When i am performing explicit casting on the same example then it works:

```
    o.sum(5, (long)5);

```