In [[Python (programming language)|Python]], [[Java (programming language)|Java]]<ref name=Bloch>''{{cite book | title= "Effective Java: Programming Language Guide''," third|last=Bloch| first=Joshua| publisher=Addison-Wesley | edition:=third {{ISBN| isbn=978-0134685991}},| year=2018, p.80}}</ref>{{rp|80}} and the [[.NET Framework]], strings are immutable objects. Both Java and the .NET Framework have mutable versions of string. In Java<ref name=Bloch>''{{cite book | title= "Effective Java: Programming Language Guide''," third|last=Bloch| first=Joshua| publisher=Addison-Wesley | edition:=third {{ISBN| isbn=978-0134685991}},| year=2018, p.84}}</ref>{{rp|84}} these are <code>[[StringBuffer]]</code> and <code>[[StringBuilder]]</code> (mutable versions of Java {{Javadoc:SE|java/lang|String}}) and in .NET this is <code>[http://msdn2.microsoft.com/en-us/library/system.text.stringbuilder.aspx StringBuilder]</code> (mutable version of .Net <code>[http://msdn2.microsoft.com/en-us/library/system.string.aspx String]</code>). [[Python 3]] has a mutable string (bytes) variant, named <code>bytearray</code>.<ref>{{cite web|url=https://docs.python.org/release/3.0/library/functions.html#bytearray|title=Built-in Functions — Python v3.0 documentation|website=docs.python.org}}</ref>
Additionally, all of the [[primitive wrapper class]]es in Java are immutable.
Line 73:
=== C# ===
In [[C Sharp (programming language)|C#]] you can enforce immutability of the fields of a class with the <code>readonly</code> statement.<ref name=Skeet>{{cite book |last=Skeet|first=Jon|title= C# in Depth |publisher= Manning |page= 239|isbn= 978-1617294532}}</ref>{{rp|239}}
By enforcing all the fields as immutable, you obtain an immutable type.