We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,325 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

exception handling

if i divide a float value from 0 then i get output:- infinity and then throws NumberFormatException why
can anybody favour me.

2
Contributors
3
Replies
21 Hours
Discussion Span
7 Months Ago
Last Updated
5
Views
rahul pareek
Light Poster
33 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Please post the code where the NFE is thrown.

JamesCherrill
... trying to help
Moderator
8,526 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,456
Skill Endorsements: 30

now i dont hav NFE
why doesn't 2.0/0.0 throws ArithmeticException

rahul pareek
Light Poster
33 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Because that's what the Java definition requires. See the Java Language Specification section 15.17.2...

Division of a nonzero finite value by a zero results in a signed infinity.

NFE is about converting a String to a float, not about arithmetic.

JamesCherrill
... trying to help
Moderator
8,526 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,456
Skill Endorsements: 30

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0654 seconds using 2.74MB