How to make class immutable

Answer Posted / a kumar

Make the class as final..
like
public final class String

Is This Answer Correct ?    7 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the 6 boolean operators?

547


What does  mean in regex?

565


Explain why wait(), notify() and notifyall() methods are in object class rather than in the reading class?

557


What is Garbage Collection in Java

607


explain the concept of virtual method invocation in polymorphism in detail?

1712






What is an example of a constant variable?

525


Can we declare a class as abstract without having any abstract method?

549


Explain the difference between an object-oriented programming language and object-based programming language?

545


What is the difference between the size and capacity of a vector?

564


What is the main functionality of the remote reference layer?

1409


Explain about transient variables in java?

636


What is the current version of java?

537


What does sizeof return?

553


Can we have multiple catch block for a try block?

584


How to split a string in java?

622