Languages
[Edit]
EN

Java - get array size

4 points
Created by:
Indira
499

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

 

Alternative titles

  1. Java - how to get size of array
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

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