gpt4 book ai didi

java - 区分 String args[] 和 String[] args

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:52:58 25 4
gpt4 key购买 nike

我见过两种不同的声明字符串数组的方法,但我不明白其中的区别。谁能解释一下

之间的区别

字符串参数[]

String[] args 

最佳答案

没有区别(在 Java 中)。它们是完全一样的东西。来自 JLS §10.2 :

The [] may appear as part of the type at the beginning of the declaration, or as part of the declarator for a particular variable, or both.

关于java - 区分 String args[] 和 String[] args,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20701077/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com