+ 3

int x,y=5,z=5; x=y==z; System.out.println(x);

Please help me find out value of x ??

18th Aug 2019, 4:34 PM
Khushi Puri
Khushi Puri - avatar
10 Respostas
+ 7
You will get compile time error. x should be boolean type not int. x= y==z x= 5==5 x= true
18th Aug 2019, 4:51 PM
voja
voja - avatar
+ 3
y==z, value of y is equal to value of z i.e. y=z=5; Therefore, y==z will return true i.e. 1 so, x will get; x=1
18th Aug 2019, 7:40 PM
Rio Fairhall
Rio Fairhall - avatar
+ 1
Thanks
19th Aug 2019, 2:40 AM
Khushi Puri
Khushi Puri - avatar
+ 1
true
19th Aug 2019, 6:10 AM
Alex Wang
+ 1
Declare x as boolean int y=5,z=5; boolean x=y==z; print(x);
19th Aug 2019, 8:31 PM
Shahid Iqbal
Shahid Iqbal - avatar
0
if x is declare as bool x, then x will get value "true"; But x is declare as int variable. So, x will get; x=1
18th Aug 2019, 7:42 PM
Rio Fairhall
Rio Fairhall - avatar
0
True
19th Aug 2019, 5:35 PM
Praveenkumar
Praveenkumar - avatar
0
Error
19th Aug 2019, 8:30 PM
Shahid Iqbal
Shahid Iqbal - avatar
0
Compilation error... As x should be declared boolean instead of int ....
24th Aug 2019, 1:54 PM
mn121
mn121 - avatar
0
X=1
12th Apr 2021, 6:58 AM
Ratnala Praveen Kumar
Ratnala Praveen Kumar - avatar