How Does Knowing Ref and Val types Help

I have been reading up on Reference and value types. I get the idea. But how does this help me while coding? I don't have any good examples to understand those times where knowing this stuff helps.


It means you can understand what your code is going to do.

It's kinda hard to write code when you can't predict what the effects of any given statement will be, due to not knowing the type system semantics.

For example, suppose you don't know how reference types work, and someone presented you with this code:

StringBuilder builder = new StringBuilder();
StringBuilder other = builder;

We know that that will print "FooBar" because StringBuilder is a reference type - the second line is only copying a reference, not creating another object. But if you didn't understand how reference types behave, you might have expected it just to print "Foo".

Need Your Help

iphone app for remember username and password

iphone objective-c core-data

is any examples out there for iphone app remember me option using coredata..

SyslogAppender: Using a pattern not starting with square brackets overwrites the host name

java log4j rsyslog

I am using log4j and the SyslogAppender class to send messages to rsyslog running on the local Linux machine (called orion). I currently have the following pattern: