Java的String数组:有没有一种方法大小的? [英] Java String array: is there a size of method?
本文介绍了Java的String数组:有没有一种方法大小的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我来自一个PHP的背景和PHP中,有一个 ARRAY_SIZE()
函数,它告诉你如何在数组中的许多元素可以使用。
I come from a php background and in php, there is an array_size()
function which tells you how many elements in the array are used.
有一个的String []
阵类似的方法?谢谢你。
Is there a similar method for a String[]
array? Thanks.
推荐答案
是。长度
(财产一样,没有一种方法):
Yes, .length
(property-like, not a method):
String[] array = new String[10];
int size = array.length;
这篇关于Java的String数组:有没有一种方法大小的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文