an int is a primitive, not an object. an int's default value is 0. of course, the array itself is an object, so you can check whether or not the array is null.
since an int cannot be null, no, you can't, but, if for instance, your elements are limited to a certain group of values, let's say, only the positive numbers, you can initialize your array and give all the elements a default value of -1, so, you can check whether the element == -1 or not.
if this is not enough, create an array of Integers instead of an array of ints.
stultuske
Industrious Poster
4,382 posts since Jan 2007
Reputation Points: 1,318
Solved Threads: 610
Skill Endorsements: 24
Create an array of Integers instead of an array of ints. Java 1.5+ supports autoboxing and unboxing so an array of Integer will accept int values.
rajesh1158
Junior Poster in Training
59 posts since Oct 2010
Reputation Points: 4
Solved Threads: 1
Skill Endorsements: 0
it won't 'accept int values', it will, however, through the autoboxing mechanism you've mentioned, transfer int variables to Integers, which then are accepted.
stultuske
Industrious Poster
4,382 posts since Jan 2007
Reputation Points: 1,318
Solved Threads: 610
Skill Endorsements: 24