Which one is valid as a replacement for foo?

Given the code fragment:
Boolean b1 = true;
Boolean b2 = false;
int 1 = 0;
while (foo) {}
Which one is valid as a replacement for foo?

Given the code fragment:
Boolean b1 = true;
Boolean b2 = false;
int 1 = 0;
while (foo) {}
Which one is valid as a replacement for foo?

A.
b1.compareTo(b2)

B.
i = 1

C.
i == 2? -1:0

D.
“foo”.equals(“bar”)

Explanation:
equals works fine on strings. equals produces a Boolean value.



Leave a Reply 1

Your email address will not be published. Required fields are marked *


DK

DK

What are you write something
int 1=0;
You should change this example
int i=0;