About Question enthuware.ocajp.i.v7.2.1262 :
Moderator: admin
About Question enthuware.ocajp.i.v7.2.1262 :
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.
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.1262 :
I just tried the following code and it seems to be working fine. Prints false, true as given in the correct option.
Can you please paste the exact code that you have in the file that you are trying to compile?
HTH,
Paul.
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]) );
}
}
HTH,
Paul.
Who is online
Users browsing this forum: No registered users and 10 guests