[an error occurred while processing this directive]

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

                         

[an error occurred while processing this directive]