id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

apcsaArraysFindLength


Given an array of ints, return the length of the array.


Remember that, for arrays, length is a field (a public final int instance variable, which although publicly accessible is also read-only) not a method.  This is unlike String objects, where length requires the parentheses.  (There's a reason: Strings contain arrays of char primitives as immutable private instance variables, and to reduce storage space they don't have an extra field just for length.  Instead, they use a method to return the length field value of the underlying array.)

apcsaArraysFindLength([0]) → 1
apcsaArraysFindLength([3]) → 1
apcsaArraysFindLength([2, 4, 5]) → 3

...Save, Compile, Run (ctrl-enter)

public int apcsaArraysFindLength(int[] nums) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 100 Post-solution available

Copyright Nick Parlante 2017 - privacy