Music, asked by Anonymous, 9 months ago

ANY BRAINLY MODERATOR PLEASE HELP ME to understand.......​

Attachments:

Answers

Answered by lavish2709yadav
1

Answer:

These are data types.

Explanation:

Most commonly used data types in Java are int (integer), char (character), float (number having decimal), double (number having decimal), String (collection of characters) and boolean (true or false).

First, let's see the following code.

int n;

n = 4;

As discussed earlier, here int n; allocates some space in the memory to the variable 'n'.

n = 4 assigns a value 4 to the variable 'n'.

So, int n is declaring that variable 'n' is an int and allocates some space in the memory to 'n'.

Then n = 4 assigns 4 to 'n'. So, now 'n' is 4.

Thus, if you want to give a character value to 'n', then use char before 'n' (instead of int). Similarly, if we want to give a float or double value to 'x', then use float or double before 'x' respectively.

Similar questions