I created a class with 2 method, one can take 3 parameter while another one can take 4.. all the parameters declared as final..
then I wrote this
if (b == "Select") {
myobj.print(a, b, c, d);
} else {
myobj.print(a, b, c);
}
it doesn’t work..
Stringare immutable, you can’t change them.Unless you are using
Stringliterals, you should always use.equals()or.equalsIgnoreCase()instead of==to compareStrings/objects.