里面是什么code为array.length()在Java中? [英] What is inside code for array.length() in Java?

查看:127
本文介绍了里面是什么code为array.length()在Java中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是存储在阵列的位置,10日

What is stored in 10th location of array say

int[] array=new int[10];

假设我们有从存储的值数组[0] 阵列[9] ,如果我要打印不使用元素

Say we have values stored from array[0] to array[9], if I were to print elements without using

array.length()

的for(int一:数组)

我该如何继续?

我的基本问题是如何将JVM确定数组的结束,是当遇到一个空解析阵列或当遇到一个垃圾的价值呢?什么是内置$ C $ array.length的C()功能?

My basic question is how will JVM determine end of array, is it when a null is encountered parsing array or when a garbage value is encountered? what is inbuilt code of array.length() function?

推荐答案

数组是有长度字段的对象。虽然循环,Java的装载长度字段和迭代反对的。

Arrays are objects with a length field. While looping, Java loads the length field and compares the iterator against it.

请参阅 10.7的数组成员的在JLS

这篇关于里面是什么code为array.length()在Java中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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