Link to home
Start Free TrialLog in
Avatar of Manikandan Thiagarajan
Manikandan ThiagarajanFlag for India

asked on

how could i make a class should be immuable

how could i make a class should be immuable
ASKER CERTIFIED SOLUTION
Avatar of Daniel Van Der Werken
Daniel Van Der Werken
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Manikandan Thiagarajan

ASKER

please give me the exac pseudo code for make the class should be immutable
public final class FinalClass {}
import java.lang.reflect.Modifier;

public final class FinalClass{


public static void main(String[] args){
try{
System.out.println("This class is "+Modifier.isFinal(Class.forName("FinalClass").getModifiers())+"ly final.");
}catch(ClassNotFoundException cnge){}
}

}

Open in new window