Examveda
Examveda

In Java, which data type is used to store numbers with decimal points?

A. double

B. int

C. float

D. decimal

Answer: Option A

Solution(By Examveda Team)

The correct answer is Option A: double.

In Java, the double data type is used to store numbers with decimal points, such as real numbers or floating-point numbers.

Here's the breakdown:

Option A: double - This is the correct data type for storing numbers with decimal points in Java. It provides a high level of precision for floating-point calculations.

Option B: int - The int data type is used for storing whole numbers (integers) without decimal points. It does not store decimal values.

Option C: float - The float data type is also used for storing numbers with decimal points, but it provides less precision compared to double. It is a single-precision floating-point type.

Option D: decimal - There is no decimal data type in standard Java. The term "decimal" is often associated with other programming languages, such as C#.

So, in Java, the data type used to store numbers with decimal points is double.

This Question Belongs to Java Program >> Data Types And Variables

Join The Discussion

Related Questions on Data Types and Variables