Page 1 of 1
About Question enthuware.ocajp.i.v7.2.1262 :
Posted: Fri Aug 24, 2012 1:20 am
by ETS User
Hello, I'm getting an error when I put this code together. 'Incompatible operand types boolean [] and boolean' my compiler complains. Any help would be appreciated.
Re: About Question enthuware.ocajp.i.v7.2.1262 :
Posted: Fri Aug 24, 2012 3:20 am
by admin
I just tried the following code and it seems to be working fine. Prints false, true as given in the correct option.
Code: Select all
public class TestClass
{
public static void main(String args[])
{
boolean[] b1 = new boolean[2];
boolean[] b2 = {true , false};
System.out.println( "" + (b1[0] == b2[0]) + ", "+ (b1[1] == b2[1]) );
}
}
Can you please paste the exact code that you have in the file that you are trying to compile?
HTH,
Paul.