aspose file tools
The moose likes Beginning Java and the fly likes == with array elements Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "== with array elements" Watch "== with array elements" New topic
Author

== with array elements

Jasper Vader
Ranch Hand

Joined: Jan 10, 2003
Posts: 284
code snippet...
boolean[] b1 = new boolean[2];
boolean[] b2 = {true , false};
System.out.println( "" + (b1[0] == b2[0]) + ", "+ (b1[1] == b2[1]) );
b1's elements are initialised to false and false...anyway, it seems that false,true is printed out...what bothers me is that == seems to be behaving like a Wrapper class equals() method here?


giddee up
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1865
hi jasper,
why it bothers u?
b1[0] , b1[1] , b2[0], b2[1] are simple boolean variables and == works same as normal == works for any other primitive data type...
whats so big deal here?
i don't understand your point.
regards
maulin.


1. Have fun @ http://faq.javaranch.com/java/JavaRaq
2. Looking for simple infix2postfix conversion and postfix evaluation package? Click here
Jasper Vader
Ranch Hand

Joined: Jan 10, 2003
Posts: 284
Hi there Maulin... thankyou, i sort of got a bit confused, thought it was a Boolean wrapper class or something...thanks for setting me straight!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: == with array elements
 
Similar Threads
The boolean Type and boolean Values
Doubt in Xor Operator
is rectangle?
Please exlain this code
logical operator doubt