Two Main methods with different signatures

后端 未结 10 1511
旧时难觅i
旧时难觅i 2021-01-18 17:53

I have following class.

public class Test {

    public static void main(Integer[] args) {
        System.out.println(\"This is not a main\"); 
    }   

           


        
10条回答
  •  梦谈多话
    2021-01-18 17:57

    Because Strings are what you're passing into the command line.

    the 45 from

    myProgram.exe 45

    is not an integer. it is a string containing the characters 4 and 5

    It just so happens that you can use a string like "45" to represent an integer. It's a little more difficult to do it the other way around.(for the user at least)

提交回复
热议问题