28.2k views
5 votes
Write a Java code statement for each of following:

a) To declare TWO (2) decimal numbers, and ONE (1) whole number.​

User Superachu
by
5.5k points

1 Answer

2 votes

Answer:

double decimal1, decimal2;

int whole;

Step-by-step explanation:

Required

Declare 2 decimals and 1 int.

The syntax to declare a variable is:

data-type variable-name;

To declare decimal, we simply make use of double or float data types.

So, we have:

double decimal1, decimal2; ----> for the decimal variables

And

int whole; ---- for the whole number

User Valeria
by
5.6k points