Computer Science, asked by abhimanyu9696, 1 year ago

Give reasons why the following assignments are false
i. int n = 15.4;
il. boolean p = "true”;
iii. String s = 'Mouse';
iv. char x = "A";
v. float f = 12;​

Answers

Answered by sakshigupta8818
8

Answer:

i) int cannot contain float value so 1st assignment is wrong it can be written as float n=15.4;

ii) true is written without inverted commas (" ")

iii) for string is not a data type

iv) char has single inverted  commas (')

v) float contains values with decimals float f=12.0;

Explanation:

Answered by Anshi2005
7

Heya mate...

Answer:

1)int n=15.4 ; is wrong as the values of int are never written in decimal form i.e. 0.0

2)boolean p ="true" ; is wrong as in using boolean we never write the values in double quotes.

3)String s='Mouse ' ; is wrong as in using String we always write the values in double quotes & not in single ones.

4)char x="A" ; is wrong as in char,boolean we never get the values in double quotes.

5)float f=12 ; is wrong as it is always written in the form of (0.0f) i.e. 12.0f

Hope it helps you ..

Please mark it as brainliest...

Similar questions