且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Void和没有参数之间有什么区别?

更新时间:2023-11-06 14:52:16

第一个函数是单个参数的函数,必须提供该参数,并且只能有效地取值 null 。除null之外的任何值都不会编译。第二个函数不接受任何参数并将 null 传递给它将无法编译。

The first function is a function of a single argument, which must be provided and can only validly take the value null. Any value other than null will not compile. The second function doesn't take any argument and passing null to it would not compile.