Printing double as integer if there are no decimals
farkhad (0)

Why "s1" and "s2" are different in the provided example code?

You are viewing a single comment. View All
malvoliothegood (147)

@farkhad
When I was researching your problem I came across some information that said when the == operator was used the tested values where compared by reference rather than value, whereas the equals function tests values. I guess you need to research if this is the case and how it applies to your code. I am not a Java expert and have not programmed using it for 20 years.