मराठी

Explain the Floating Point data tyре.

Advertisements

प्रश्न

Explain the Floating Point data tyре.

स्पष्ट करा
Advertisements

उत्तर

The Floating Point Data Type in Java is a primitive data type used to store numerical values containing decimal points. It is mainly used for calculations involving fractional numbers.

  1. float: It occupies 4 bytes (32 bits) of memory and stores decimal numbers with single precision (approximately 6–7 decimal digits).
  2. double: It occupies 8 bytes (64 bits) of memory and stores decimal numbers with double precision (approximately 15–16 decimal digits).

Example:

float price = 25.5f;
double salary = 45000.75;

Here, float and double are used to store decimal values with different levels of precision.

shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 6: Variables and Expressions - EXERCISE [पृष्ठ १३१]

APPEARS IN

धीरज मेहरोत्रा Computer Science [English] Class 12
पाठ 6 Variables and Expressions
EXERCISE | Q 5. | पृष्ठ १३१
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×