answersLogoWhite

0

by making that class final

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

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 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 mutable and immutable in java and example program?

lmutable object


How an exception subclass is created in java explain?

We can create a exception sub class by extending Exception class available in java


What is classes in java?

class is a blueprint which does not have its own existence but it can pass all of its feature to its child classes.


How you make a project in java?

You create a text file with a .java extension. Then you put a proper class definition.


Program in Java to create file and copy content of an existing file to it?

You need to use File class to create file in java and than Reader class implementation such as BufferedReder to read content.


What is mutable in java?

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


What class can you extend to create a simple class that provides remote methods using RMI in java?

Remote


Where can one watch immutable objects?

An immutable object is classed in Java programming as an object that cannot be changed after it is made. YouTube has videos that can be viewed on this subject as well as Vimeo.


How can you create user defined immutable object in java?

Define your own class which will have all members final & methods to return values of variable only /* javavishal.blogspot.com This code shows the way to make a class immutable */ // The immutable class final class VImmutableClass { // instance var are made private & final to restrict the access private final int prop1; // Constructor where we can provide the constant value public VImmutableClass(int vprop1) { prop1 = vprop1 } // provide only methods which return the instance var // & not change the values public int getProp1() { return prop1; } } // class MyImmutable public class MyImmutable { public static void main(String[] args) { VImmutableClass obj1 = new VImmutableClass(3); System.out.println(obj1.getProp1()); // there is no way to change the values of count & value- // no method to call besides getXX, no subclassing, no public access to var -> Immutable } }


For what purpose constructors are used in Java?

Constructors are used to create the instance of a class.