I apologise if this question is realy silly but I was wondering if anyone could tell me why this happens:
String helloString = "hello";
String referenceOfHello = helloString;
helloString = "bye";
System.out.println(referenceOfHello);
and the output is hello. I was expecting bye to be output but that didn't happen. I know this is a very basic question but I always thought that referenceOfHello stored the memory location of helloString, instead of its value.
Thanks.