An immutable object is an object that once is created it can't change its value.
Un obiect imuabil (immutable) este un obiect care odata ce este creat nu isi poate modifica valoarea.
Based on the definition of the immutable object, if you want to implement your own immutable class, it will look like this
Pe baza definitiei unui obiect immutable, daca doriti sa definiti propria clasa immutable (imuabila), aceasta poate arata astfel
Besides String, there is another immutable object, and this is Integer (the class and not the primitive) which has an interesting behavior for values between -128 and 127.
In afara de String, exista si alte obiect imuabile, iar unul dintre acestea este Integer (clasa si nu tipul primitiv), care are un comportament interesant pentru valori intre -128 si 127.
The most known immutable object in Java is String.
Obiectul immutable cel mai cunoscut in Java este String.
Another type of immutable object in Java, is Integer (there are others, like Double, Color, ...).
Un alt tip de obiect immutable in Java, este Integer (exista si altele, cum ar fi Double, Color, ...).
Conteúdo potencialmente sensível ou impróprio
Os exemplos servem apenas como ajuda na tradução da palavra ou da expressão procurada. Eles não são selecionados ou validados por nós e podem conter linguagem inapropriada. Pedimos que reporte exemplos que devem ser modificados ou que não devem ser exibidos. As traduções potencialmente sensivéis, impróprias ou coloquiais geralmente são marcadas em vermelho ou em laranja.