Originally posted by krishna:
Hi,
How the following code is giving true as output...
int i=10;
int j=10;
boolean b=false;
if(b=i==j)
System.out.println("true");
else
System.out.println("false");
as conditional operators have higer precedence i==j will be evaluated and returns true ,but b is defined as false,so
if(b=....) returns false ..please can anybody help me..thanks in advance
regds
krishna
since i==j returns true, that is assigned to b. Assignment b=true returns true,and hence the answer
Savithri
[This message has been edited by Savithri Devaraj (edited August 17, 2000).]