Java Tricky Programming Questions| Data Types | Variables | Operators | Java Tutorials

preview_player
Показать описание
#javatrickyquestions #basicsofjava #codingforbeginners

Q.1) How to add int and double value in Java?
int i = 2;
double d = 3.0;
double result = (i + d);

Q.2)What will be the value of a?
int a = 5+5*2-1+2/2+(2*3);
// 5+5*2-1+2/2+6
// 5+10-1+1+6
// 15-1+1+6
// 14+1+6
// 15 + 6
// 21

Q.3) What will be the output of the following program?
int a=10;

Q.4)What will be the output of the following program?

int a=10;

Q.5) What will be the output of the following program?
int a=20;
a= a++ + a++; // 20 + 21 - 41

Рекомендации по теме