S
soup_or_power
Hi All
Please tell me how nested statements are handled in java.
Here is an example:
String st="abcdefghijk";
st=st.replaceAll("a", "x").replaceAll("b", "y").replaceAll("c", "z");
The expected result is xyzdefghijk.
2nd way:
st=st.replaceAll("a", "x");
st=st.replaceAll("b", "y");
st=st.replaceAll("c", "z");
I have 2 questions:
a) the first one doesn't work for complicated expressions: example
replaceAll("&abc", "")
given as arguments to replaceAll
b)is there any advantage to the first given that un-interned strings
are allocated new memory locations?
Thanks for your help.
Please tell me how nested statements are handled in java.
Here is an example:
String st="abcdefghijk";
st=st.replaceAll("a", "x").replaceAll("b", "y").replaceAll("c", "z");
The expected result is xyzdefghijk.
2nd way:
st=st.replaceAll("a", "x");
st=st.replaceAll("b", "y");
st=st.replaceAll("c", "z");
I have 2 questions:
a) the first one doesn't work for complicated expressions: example
replaceAll("&abc", "")
given as arguments to replaceAll
b)is there any advantage to the first given that un-interned strings
are allocated new memory locations?
Thanks for your help.