Post a Job  |   Ask a Question?   |   Already registered? login or register
Vivek Tiwari
16/12/2016 02:32 PM

Coe java

What is muttable and immutable object? why we need immutability?
Spam    4 Comments

16/12/2016 22:29:31
immuttable is a not changable, and mutable is a changable nature. example for immutable is Username (gmail,facebook id) example for mutable is password the password is changable

17/12/2016 00:51:16
An Immutable object is a kind of object whose state cannot be modified after it is created. This is as opposed to a mutable object, which can be modified after it is created. In Java, objects are referred by references. If an object is known to be immutable, the object reference can be shared. For example, Boolean, Byte, Character, Double, Float, Integer, Long, Short, and String are immutable classes in Java, but the class StringBuffer is a mutable object in addition to the immutable String.

02/01/2017 19:27:58
Immutable objects are simply objects whose state (the object's data) cannot change after construction.Ex of immutable objects are String ,Integer. Immutable Objects are simple to constrcut,test and use are automatically thread-safe and have no synchronization issues don't need a copy constructor don't need an implementation of clone

02/01/2017 22:29:56
->>>Immutability in a "weak" sense (for lack of a better term) means creating a temporary read-only view of otherwise modifiable data. ->>>Immutability in a "strong" sense means locking down a piece of data in perpetuity, such as creating an immutable object instance that cannot be changed by any code.

Languages :