返回此范围中的元素数。
句法
- int size()
参数
没有
返回值
返回范围的大小。
下面是一个使用这个方法的例子 -
- class Example {
- static void main(String[] args) {
- // Example of an Integer using def
- def rint = 1..10;
- println(rint.size());
- }
- }
当我们运行上面的程序,我们将得到以下结果 -
- 10
转载本站内容时,请务必注明来自W3xue,违者必究。
返回此范围中的元素数。
- int size()
没有
返回范围的大小。
下面是一个使用这个方法的例子 -
- class Example {
- static void main(String[] args) {
- // Example of an Integer using def
- def rint = 1..10;
- println(rint.size());
- }
- }
当我们运行上面的程序,我们将得到以下结果 -
- 10
转载本站内容时,请务必注明来自W3xue,违者必究。
本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728
W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。