Object obj[] = new Object[3];
if ( obj != null ){
System.out.println("The value is not null");
}else {
System.out.println("The value is null");
}
in the case of arrays how you will solve????
In the case of array of objects handling of null pointer exception is a tedious task, we have to check each and every individual elements before its usage
I found same solution in Spring framework's source code.
They are created a class named Assert and written a static method for
checking the
Null
Thank you Baiju annan and spring source
On Feb 10, 5:52 pm, Baiju Chandran <baijuchandr...@gmail.com> wrote:
> In the case of array of objects handling of null pointer exception is a
> tedious task, we have to check each and every individual elements before its
> usage
>
> public static boolean isNullOrEmpty(Object[] array) {
> if (array == null || (array != null && array.length == 0)) {
> return true;
> } else {
> return false;
> }
> }
>
> On Tue, Feb 9, 2010 at 6:52 PM, Rejin Chandran <reji...@gmail.com> wrote:
> > Object obj[] = new Object[3];
>
> > if ( obj != null ){
> > System.out.println("The value is not null");
> > }else {
> > System.out.println("The value is null");
> > }
>
> > in the case of arrays how you will solve????