File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

== with array elements

 
Jasper Vader
Ranch Hand
Posts: 284
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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!
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic