List some Immutable classes in Java?

REMONTEr
REMONTEr

Posted On: Apr 08, 2020

 

An immutable state indicates that once an item is designed, we may not be able to alter its element. Seldom it is important to create an immutable set as per the terms. ImmutableList, as implied by the title, is a kind of List that is changeless. It indicates that the content of the Program is established or unswerving after the declaration, which means, these are read-only. If any effort made to compute, delete and refresh components in the List, UnsupportedOperationException is discharged.

For instance, Character, Double, Boolean, Byte, Float, Long, Short, String, Integer and all fundamental wrapper groups are immutable classes.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Cognizant Java Interview Questions

    What is a Singleton in Java?

    Singleton class in Java contains only one object at one time. For the designing of the singleton class, the construction needs to be private. The static method needs to be written to return the object...

    Cognizant Java Interview Questions

    Is Java supports multiple inheritance?

    When one class extends for more than one class, then it is known as multiple inheritance. No, Java does not support multiple inheritance to prevent the ambiguity that it can cause. The diamond proble...

    Cognizant Java Interview Questions

    What is JPA and Junit?

    JPA or Java Persistence API is a mechanism through which JAVA can outlive the application processes that have created them. JPA allows you to define which objects are persisted and how they should be ...