Difficult stuff.
Another java question.
When I use
If statements sometimes I'm supposed to use ( == ) but sometimes people tell me it's better to have ( .equals ). I've never understood when.
You need to know the differences between primitives and objects in java. When you want to compare value between primitives you can use == operator. while the same case cannot be done with object.
The easiest example in this case is String,
String str1 = new String("value1");// create new object
String str2 = new String("value1");// create another new object
System.out.println(str1 == str2);/* will print false, because it compares whether str1 and str2 refers to same object.*/
System.out.println(str1.equals(str2));/* will print true, because the value of this two objects are equal*/