hello there, is there anyone who can tell me hwo to actually check whether an an int array element is a null or not? in java, I tried (array[i]==null) or (array[i].equals("")) but it seems that the compiler will tell me that int is incomparable to null or string everytime I used those two to check whether my int array element is a null or not. Besides, I also used (array[i]==0), but this cant really check whether the int array element is null or not right? So I am wondering is there anyone that can help me to solve this problem.
jjjmikalord
0
Newbie Poster
Recommended Answers
Jump to Postan 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 …
All 3 Replies
stultuske
1,116
Posting Maven
Featured Poster
rajesh1158
-6
Light Poster
stultuske
1,116
Posting Maven
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.