Where length is declared in java and how it works?

Where length is declared in java and how it works?

You can't possibly be expecting a helpful answer to a question like that. We need more detail. What is length? A user variable? Put some effort into asking the question if you want others to put effort into answering the question.

You can't possibly be expecting a helpful answer to a question like that. We need more detail. What is length? A user variable? Put some effort into asking the question if you want others to put effort into answering the question.

sorry i asking by using example below

int[] arr = new int[10];

int i = arr.length;

above length is declared somewhere but i dont know where is it?

And you don't need to. An array is a special type of Object, and length is a field of that object. But the "objectness" (yes, I can make up words) of an array is not something you need to worry about.

if you really want to know, the members of an array are specified in JLS 10.7

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.