Home Java Java-get-example Get Array Size
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Get Array Size

Advertisement
To calculate length of the given array we have used length property. It returns the length of the given array.

Get Array Size

     

To calculate length of the given array we have used length property. It returns the length of the given array.

 

 

 

 

 

 

public class SizeOfArray {
  public static void main (String args []) {
 
  int num[] = {123456789};
  String days[] = {"Sunday","Monday","Tuesday""Wednesday",
  "Thursday"
,"Friday","Saturday"};
  System.out.println("size of num[]: " + num.length);
  System.out.println("size of days[]: " + days.length);
  }
}

Output will be displayed as:

Download Source Code

Advertisements

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 22, 2008

Ask Questions?    Discuss: Get Array Size  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
Kalyan Kaldate
September 19, 2011
Query about Get Array Size

Is SizeOfArray a function or classname in code for Get Array Size?
Atul Sharma
July 10, 2014
Calculate Array length

My Question is How to calculte the length of array without using LENGTH function or Is there any way to find the Length of array other than (array.length)
DMCA.com