converts the value 10000 to a string, which is a double(so 10000 becomes 10000.0) in this case it is "10000.0" and stores it in the variable str.
In the System.out.println statement an addition is performed. with a string and a float.
So it simply adds these two like this
String equals method returns true or false based on the two string which it compares, in this case, "Anuradhapura" & "Anuradhapura" which is same.
So the answer is true.
But if they use == the return value is false since the == checks whether it references to the same object (memory space) which is wrong.
When a String variable is declared it always create a new object(which is a String object).
String objects cannot be changed, they are immutable.
public class test{
public static void main(String args[]){
boolean a=false;
System.out.println(a=a);
}
}
ai mekedi output eka false wenne?
= kiyanne assgnment oprator eka.
a=a;
left side eke thiyana eka variable eka...
right eke thiyana eke value eka a ta assgn karagannawa..
mulin declare karala thiyanawa..
eka false kiyala..
data type eka boolean
out put false..
== thibbanam equalda kiyala balala ehemanam true retun karanawa nethnam false..
a==a
oya daala balanna..
if any correction plz..