When I call up a method from the other class, it returns null. I'll just show you my code below
class One{
Two two;
oneMethod(){
String str = "";
two.twoMethod(str);
S.o.p("Str in One class is " + str);
}
}
class Two{
String twoMethod(String str){
str = "From Two class";
S.o.p("Str in Two class is " + str);
return str;
}
}
The output looks like: Str in One class is ___ // meaning null
Str in Two class is From Two class
My understanding about this is, after calling twoMethod(), the str with which is initially null will now be overriden with the new str value "From Two class". Now when we print str in One class, it should be the same with what is printed in the Two class. That's how I understand the flow.
Did I miss any concept / rule about passing Strings? Any feedback is appreciated. Thanks!