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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
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: 1871
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.
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://aspose.com/file-tools
 
subject: == with array elements