Languages
[Edit]
EN

Java - get array size

4 points
Created by:
Indira
319

In java every array has property .length not a method .length() or .size().

Examples:

int[] intArray = new int[3];
int length = intArray.length; // 3

int[] intArray = {1, 2, 3};
int length = intArray.length; // 3

String[] stringArray = new String[3];
int length = stringArray.length; // 3

String[] stringArray = {"A", "B", "C"};
int length = stringArray.length; // 3

 

Java - Arrays (popular problems)

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join