What is the "length" in the char[]?

java

Solution

char[] is not a primitive data type. it is an Object, and it has a public field 'length'.

http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html

That is a good start.

Because Arrays are Objects, they have all the other items, like an equals() and hashCode() method too. (as well as all the treats like notify(), wait(), etc.)

Problem

``` char[] name = "VIKKYHACKS".toCharArray(); System.out.println(name.length); ``` In this program what is the "length" , If it were `(new String("VIKKYHACKS")).length()` then the length would be a method. But char[] is a datatype and cannot have fields or methods inside it. How does the second line of that program work ???

Original source