I'm not getting when and where we should use string, double ,byte, short,int,float in computer programming
explain it in simple form because tomorrow I hv my exams
9th icse
Answers
Answer:
string is for words
syntax String variable = "statement";
eg
String s = "wow";
for int , short, long we must initialize only a whole number
byte it is less than 8bits
double and float it is decimal no
boolean is for true and false
Explanation:
Answer:
byte – has a minimum value of -128 and a maximum value of 127 (inclusive).
short– has a minimum value of -32,768 and a maximum value of 32,767 (inclusive).
int: – has a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647 (inclusive).
long – has a minimum value of -9,223,372,036,854,775,808 and a maximum
value of 9,223,372,036,854,775,807 (inclusive).
float – a floating point number with 32-bits of precision
double – this is a double precision floating point number.
Explanation:
The data types that hold numeric values are: byte, short, int, long, float and double. The difference between them is the size and precision of the value they contain.
Multiple characters or ‘strings’ (eg words and sentences) are also supported in Java through the use of String.