java.lang.NullPointerException

I have posted a part of my problem at http://forum.java.sun.com/thread.jspa?threadID=5170146

and I commit I was not clear to explain my problem.

PROBLEM:

I have given check boxes and trying to get one or more checboxes but when checkboxes are empty it throwsjava.lang.NullPointerException Please guide and help me.

thanks

PreparedStatement ps6 = cnn.prepareStatement(sql6);

for (i=0;i<product.length;i++){

if(!product[i].equalsIgnoreCase("null")){

ps6.clearParameters();

ps6.setString(1, product[i]);

ps6.addBatch();

}

ps6.executeBatch();

}

ps6.close();

>

[864 byte] By [farakha] at [2007-11-27 3:59:25]
# 1
"null" is not a String. It's a keyword.I would suggest to go back to the Java basics: read some basic tutorials or buy a good book :)
BalusCa at 2007-7-12 9:03:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
I replaced *.equalsIgnoreCase("null") into *.equals("")even then there is no effect.
farakha at 2007-7-12 9:03:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Do you know what are null and empty String ?
rym82a at 2007-7-12 9:03:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
> Do you know what are null and empty String ?thanks for your reply. Please plz correct my mistake. I'll thankful to you
farakha at 2007-7-12 9:03:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Once more again: null is definitely not a String. It is a keyword which definies the value of an uninstantiated Object.A NullPointerException is usually thrown when you want to access an uninstantiated Object.
BalusCa at 2007-7-12 9:03:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
Instead of gvng like dis if(!product.equalsIgnoreCase("null"))give like disif("null".equalsIgnoreCase(product))just try dis.
adept17a at 2007-7-12 9:03:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
if(!"null".equalsIgnoreCase(product))
adept17a at 2007-7-12 9:03:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
An example of using nullObject obj = getSomething();if (obj == null){// do something}
rym82a at 2007-7-12 9:03:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9
use null(keyword) instead of "null"
dipak66a at 2007-7-12 9:03:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 10
It will be more helpful to help you if you provide information on the line of code where null pointer is being thrown.
kalyan.indiana at 2007-7-12 9:03:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 11
thaks to all specially BaluCthe problem solved
farakha at 2007-7-12 9:03:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...