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



Get Array Size
Posted on: October 22, 2008 By Deepak Kumar
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


Recommend the tutorial

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?