This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

== with array elements

 
Jasper Vader
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 284
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic