Home Java Java-get-example Get Array Size



Get Array Size
Posted on: October 22, 2008 at 12:00 AM
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

Related Tags for Get Array Size:
carraypropertysedreturnlengthtoeituseulpecalcalccacalculateprosurnatlatehaivproperrayarrtropessthavproppro


More Tutorials from this section

Ask Questions?    Discuss: Get Array Size  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.