b1.toString()==b1.toString() // return a new String with the Byte representation (both are diff references) b1.toString().equals(b1.toString()) // using .equals, data in the string is equal b1.toString().equals(b1)// - comparing a String with byte, instanceof fails - false
First line two references to different String objects are being compared. Second line the (identical) contents of two different String objects are being compared. Last line a String object is being compared to a Byte object. (So it fails the instanceof test in the equals method)
Or at least that's what I think is going on.
[ April 17, 2007: Message edited by: Barry Gaunt ]