'Fruit ...'是Java命名约定中的有效类名吗?(Is 'Fruit…' a valid class name in Java Naming conve

系统教程 行业动态 更新时间:2024-06-14 16:59:46
'Fruit ...'是Java命名约定中的有效类名吗?(Is 'Fruit…' a valid class name in Java Naming convention?)

我是Java的初学者,在我探索的过程中,我看到了一个代码,它的用法是Fruit... fruitName ? 我曾经在任何文档中看到过这样的用法,比如...

任何人都可以知道这个用途是什么以及如何使用?

I'm a beginner in Java, and while I was exploring I got to see a code which has the usage as Fruit... fruitName? I have ever seen such a usage in any documentation like ...

Can anyone know what and how the usage of this?

最满意答案

class Fruit { // Class implementation } public void extractJuice(Fruit... args) { // This method can take variable arguments of type Fruit }

所以你所看到的是变量参数的缩写。

其他参考文献: - 你什么时候在Java中使用varargs?

class Fruit { // Class implementation } public void extractJuice(Fruit... args) { // This method can take variable arguments of type Fruit }

So what you are looking at is varargs short for Variable Arguments.

Futher references: - When do you use varargs in Java?

更多推荐

本文发布于:2023-04-17 08:41:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/460844e25525da94ca070666d30f6c53.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:类名吗   Java   Fruit   valid   convention

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!