D
D
demol2021-07-13 14:55:13
Java
demol, 2021-07-13 14:55:13

What could be wrong with accessing the .lenght field of a simple array?

Help, please, deal with the .lenght field. I can't count the number of elements. I can't figure out what I'm doing wrong.
Code example:
public class Phrase{
public static void main (String[] args) {
String[] dou = {"abc", "abcd", "adcde", "abcdef"};
intx;
x = dou length;
}
}

Error

Phrase.java:6: error: cannot find symbol
x = dou.lenght;
^
symbol: variable length
location: variable dou of type String[]
1 error

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2021-07-13
@demol

Length th , not length ht .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question