answersLogoWhite

0

What is mutable in java?

Updated: 10/23/2022
User Avatar

Wiki User

11y ago

Best Answer

It means that something can be changed after it is created. Immutable means that it can't be changed.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is mutable in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is mutable member?

A variable that may be modified.


Are Wrapper classes immutable or mutable?

In java.lang all Wrapper classes are immutable .


What is a constant member function c plus plus?

A constant member function is an instance method that can only modify the mutable members of the class instance. This is achieved by implicitly declaring the this pointer constant. The this pointer is a hidden parameter that is implicitly passed to every instance function, and that points to the current instance of the class. Static member functions do not have an implicit this pointer and therefore cannot be declared const. Consider the following simple class that has both mutable and non-mutable member variables, and both constant and nonconstant member functions: struct foo { void constant()const; void nonconstant(); private: int data1; mutable int data2; }; void foo::constant()const { data1++; // not permitted: the implicit this pointer is declared const data2++; // ok: data2 is mutable } void foo::nonconstant() { data1++; // ok: the implicit this pointer is declared non-const data2++; // ok: data2 is mutable } Note that data2 can always be modified since it is declared mutable, but data1 can only be modified by nonconstant member functions. Members should only be declared mutable when they are only used internally by a class (such as when locking a mutex for thread safety), or where a value needs to be calculated and cached the first time it is accessed.


What is the use of StringBuilder in java?

The StringBuilder class was added in Java 5. It has exactly the same API as the StringBuffer class, except StringBuilder is not thread safe. In other words, its methods are not synchronized. Sun recommends that you use StringBuilder instead of StringBuffer whenever possible because StringBuilder will run faster. So apart from synchronization, anything we say about StringBuilder's methods holds true for StringBuffer's methods, and vice versa.


Does Visual Java plus plus and Java Builder is different from the Java language?

Yes!Visual Java plus plus and Java Builder is different from the Java language?

Related questions

What mutable and immutable in java and example program?

lmutable object


Which classes are mutable and nonmutable?

An immutable class is any data storage class in which the data cannot be changed. The most common example of this in Java is the String class.


What is the Tagalog of mutable?

The Tagalog word for "mutable" is "maaring baguhin" or "mababago."


What is string buffer in java?

StringBuffer is java class available in java.lang package which provides mutable String object where String is immutable class. The methods of this class like reverse(), append(),insert() gives facility to insert data of the same object.


What are mutable classes?

All classes that we create are mutable class. No special technique is used. Don't get confused. Mutable is said to compare it with immutable classes. That's it.


What is a sentence using the word mutable?

the stock market experiences mutable money surpluses and losses.


How do you use mutable in a sentence?

Mutable is used to describe something that is liable to change. A sentence using the word could be "The personalities of young girls seem mutable depending on which group of peers they may be around."


What are the zodiac elements?

Aries - Cardinal Fire Taurus - Fixed Earth Gemini - Mutable Air Cancer - Cardinal Water Leo - Fixed Fire Virgo - Mutable Earth Libra - Cardinal Air Scorpio - Fixed Water Sagittarius - Mutable Fire Capricorn - Cardinal Earth Aquarius - Fixed Air Pisces - Mutable Water


What is mutable member?

A variable that may be modified.


What is a synonym for the word variable?

inconstant, mutable


What are the release dates for Mutable Fire - 1984?

Mutable Fire - 1984 was released on: USA: 1984 (limited) Czech Republic: 14 September 2003 (CESTA Festival)


Does an inconsistent person have mutable opinions?

No, because there are believable answers