为什么varargs总是方法签名中的最后一个参数? [英] Why is varargs always the last parameter in a method signature?

查看:131
本文介绍了为什么varargs总是方法签名中的最后一个参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么 varargs 必须是方法签名中的最后一个参数?

Why does varargs have to be the last parameter in method signature?

我想知道原因。

推荐答案

因为它使编译器的生命更简单。没有真正的理由为什么之后不能拥有更多的参数,但它需要更复杂的编译器,所以规范是这样编写的。

Because it makes the compiler's life simpler. There's no real reason why it couldn't have more arguments after, but it would require a much more complex compiler and so the spec was written that way.

这篇关于为什么varargs总是方法签名中的最后一个参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆