This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes  Null Pointer exception despite using Float Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark " Null Pointer exception despite using Float " Watch " Null Pointer exception despite using Float " New topic
Author

Null Pointer exception despite using Float

Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477


Hi All ,
Im trying to insert null values into a database for a particular column , if there has been no entry into a field .
I'm using a bean to carry my data around .



fmotorrating is defined as

Any pointers as to why this could be happening?


Learning and Learning!-- Java all the way!
Harsha Smith
Ranch Hand

Joined: Jul 18, 2011
Posts: 287
.equals or == null?

Line 2
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Are you sure you get exception at stmt.setNull(8, Types.FLOAT); ? because even I doubt that how the if statement is succeed?
lokesh pattajoshi
Ranch Hand

Joined: Jul 29, 2009
Posts: 130
Hi,

If is returning null than in that line only you will get Null Pointer Exception as you can't use dot operator on null.

Instead of you can use
Regards,
Lokesh
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Hi All I tried that , earlier it wasnt working however now its working . Weird .

Thank you for your help . All!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Null Pointer exception despite using Float
 
Similar Threads
Getting float value from string
JTable - JDBC - Vectors
How to check a datatype of a variable
Assignment doubt
Problem with default '' , 0 and 0.0 being inserted into database while using JSTL.