Local variables of same name in same scope, IDE display error but when I run the program, no run time error results

后端 未结 3 1042
误落风尘
误落风尘 2021-01-26 03:57

I understand that it is illegal to declare local variables of the same name in the same scope. I wrote this very simple class, and yes, the IDE does display an error next to

3条回答
  •  离开以前
    2021-01-26 04:38

    Because in run time. You never called your method "VariableWithSameName" and that's why. run time error will only occur if a system run onto an error . but compile time error will determine all possible errors that in can found during compilation

提交回复
热议问题