What are floating-point literals?

February 7th, 2008 by uCertify Leave a reply »

Floating-point literals are decimal numbers. They can be expressed in either standard or scientific notation.

Standard notation consists of a whole number followed by a decimal point and a fractional component. Examples of floating-point literals expressed in standard notation are 3.145, 2.0, etc.

Scientific notation consists of standard-notation, i.e., a floating-point number, and a suffix that specifies a power of 10 by which the number is to be multiplied. The exponent portion is either represented by an E or e, followed by an integer, which can be either positive or negative. Examples of floating-point literals expressed in scientific notation are 6.02E23, 1e-6, etc.

Floating-point literals are of type double, by default. A floating-point literal, is followed by an F or f, to indicate that the literal is of type float in a program, e.g., 6.023E2F, 23.34f, etc.

Note: Floating-point literals cannot be expressed in hexadecimal and octal notation.

Click here to download scja test study guide and practice question. Pass SCJA in first attampt.
Like this article? Share it with others
If you like this article, please leave a comment or subscribe this blog via RSS or via e-mail, Bookmark and share through your network. Click the AddThis button below. Thanks.
  • Share/Bookmark
Advertisement

Leave a Reply

uCertify.com | Our Company | Articles | Contact Us | News and Press Release | uCertify India | Entries (RSS)
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD    Cisco Certification: CCNA, CCENT    A+, Network+, Security+ Project+
Oracle Certification: OCP 11g, OCP 10g, OCA 11g, OCA 10g    CIW foundation    EC-212-32,    CISSP    Photoshop ACE CS4    Adobe Flash ACE, PMP, CAPM
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.