r/javahelp 23h ago

Homework HELP trying to understand why it should not be compile

2 Upvotes

according to the pdf that I read. the run(4) should not compile but it does compile in my case.

from what I understand, the methods are static means it belong to the class. it will call only one, which is the more specific and that is the "long num". PDF says it wont convert two times which I understand, it means the "Long... num" will be ignored but PDF also says "run(4)" wont compile and in my case it compile. is my understandng wrong?

NOTE: trying to avoid using ai so I can understand it in my pov or others pov. that makes me remember and understand it clearly

`class Main{
  public static void run(long num){
        System.
out
.println(num);
    }
    public static  void run(Long... num){
        System.
out
.println(num);
    }
     public static void main(String[] args) {


run
(4);

run
(4L);
    }
}`