About Question enthuware.ocajp.i.v7.2.1262 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
ETS User

About Question enthuware.ocajp.i.v7.2.1262 :

Post 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.

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1262 :

Post 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.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests