size of an array

How to find the no of elements in an array in java

Page 1 of 1

1 Replies - 904 Views - Last Post: 16 December 2009 - 08:27 AM Rate Topic: -----

#1 narun  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 16-December 09

size of an array

Posted 16 December 2009 - 08:19 AM

How to find the no of elements in an array in java
Is This A Good Question/Topic? 0
  • +

Replies To: size of an array

#2 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3101
  • View blog
  • Posts: 19,141
  • Joined: 14-September 07

Re: size of an array

Posted 16 December 2009 - 08:27 AM

Every array in java has a length variable:

arrName.length




If you "can't" use it due to an academic constraint the next best option is to iterate through and increment a counter.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1