Mutable and immutable Objects

Ads

 
 
 

Share on Google+Share on Google+

Deepak Kumar
Mutable and immutable Objects
1 Answer(s)      6 years and 7 months ago
Posted in : Java Beginners
Hi,

Please tell me about Mutable and immutable Objects.

What is mutable object and immutable object and how to use it correctly.

Thanks
Ads
View Answers

October 5, 2010 at 5:49 PM


Hello,
Mutable are those object which we can alter. like any primitive. Immutable are those object whcih we can not alter like String
ex String s = "hello"
create a new object in string pool "hello" reffrenced by s

s = "hi"
create new string "hi" refrenced by s. above "hello" obj is still in string pool only the reffrence s is now maped to "hi".

Thanks

Ads









Related Tutorials/Questions & Answers:
Mutable and immutable Objects - Java Beginners
Mutable and immutable Objects  Hi, Please tell me about Mutable and immutable Objects. What is mutable object and immutable object and how to use it correctly. Thanks   Hello, Mutable are those object which
what is mutable and immutable object in java ?difference ?
what is mutable and immutable object in java ?difference ?  what is mutable and immutable object in java ?difference
Advertisements
immutable class
immutable class  How to make a class immutable
change value of mutable string
change value of mutable string  How to change value of mutable string
String immutable - Java Beginners
String immutable  Why is String immutable?  See here Why String is immutable in Java
Mutable Image
Mutable Image       This is the Mutable image example which shows how to create the mutable image using canvas class. In this example the ImageCanvas1 class extends the Canvas
STRING IMMUTABLE - Java Interview Questions
STRING IMMUTABLE  Why string objects are immutable? what... efficiency instead of creating the new String objects. So, whenever you create... in the pool. There will be many references point to the same String objects
IMMUTABLE - Java Interview Questions
IMMUTABLE  How To Make A Class Immutable?  Hi Friend, To make a class immutable we must restrict changing the state of the class...; } } public class Immutable{ public static void main(String[] args
Immutable Image using Canvas Class
Immutable Image using Canvas Class       This is the immutable image example which shows how to create the immutable image using canvas. In this example ImageCanvas class
Immutable Image MIDlet Example
Immutable Image MIDlet Example       This is the immutable image example, which shows how to create a immutable image in MIDlet. In this example we are creating
Objects
Objects       Objects In this section we are going to illustrate how the real life objects are the key to understand object-oriented technology Objects are the part of our day to day
Implicit objects
Implicit objects  What are the implicit objects
Data objects
Data objects   hello,, What are data objects?   hii, Sequences, Views, clusters, Tables, index and cluster are called data objects for a database
Java Objects
Java Objects  What are Data Transfer Objects and where are they used
classes and objects
classes and objects  Define a class named Doctor whose objects are records for a clinic√Ę‚?¨‚?Ęs doctors. Derive this class from the class Person... and Billing, whose objects are records for a clinic. Derive Patient from
Classes and Objects
Classes and Objects       Objects... the main() method.  A class can have more than one instances (objects), let us... techniques. A class defines the properties of  objects and methods used
Objective C Array
is a collection of number of other objects. In Objective C, we can also add and remove the objects from the given list of array if the array is declared mutable...;Yellow", nil]; or Mutable Array like: NSMutableArray *myMutableArray
count objects php
count objects php  How to Count and show objects in PHP
Are objects passed by value or by reference?
Are objects passed by value or by reference?  Are objects passed by value or by reference
What are the benefits of detached objects?
What are the benefits of detached objects?   Hi, What are the benefits of detached objects? Thanks
class with in its own objects?
class with in its own objects?  Is it a good idea to declare a class with in its own objects
Benefits of detached objects in hibernate
Benefits of detached objects in hibernate  What are benefits of detached objects in hibernate?   Detached objects can be passed across... Transfer Objects). You can later on re-attach the detached objects to another
Objects in Java
Objects in Java Whatever we can see in this world all the things are a object. And all the objects are categorized in a special group. That group is termed as a class. All the objects are direct interacted with its class that mean
implicit objects in jsp
implicit objects in jsp  hello, how many implicit objects in jsp???   hello, I am giving implicit object out,config,page,application,request,page context,response,session
Flex Objects
: #FFFFCC; } Objects are real entity conforming the template or blueprint defined by its class. The class defines the properties and behavior for its objects... objects of these classes according to the need of your application
Get Duplicate Objects from an ArrayList of Objects
Get Duplicate Objects from an ArrayList of Objects  public class Order { private String portId; private String action; private String idType; private String id; private BigDecimal amount; public String getPortId
Transient and detached objects
Transient and detached objects  Explain the difference between transient (i.e. newly instantiated) and detached objects in hibernate
Java Objects - Java Beginners
Java Objects  Hi I have the following question, What method in Java is used to destroy your objects. Thanks in advance
Program to implement array of Objects.
Program to implement array of Objects.  Create a class it has.... Initialize an array of objects. Pass a name from the command line & search for the name in the array of objects , if it is existing print the information
Tutorials   
Java Spring Hibernate Struts Training ClassNotFoundException HttpRequestInterceptor java.lang.noclassdeffounderror: org/apache/http/httprequest noclassdeffounderror: org/apache/http/client/methods/httpurirequest java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java

Ads

 
Advertisement null

Ads