Blogger

Delete comment from: Javarevisited

Forget ALL SECURITY REASONS. As regarding security reasoning String IS mutable:

package com.verhas.elrettentopelda;

import java.lang.reflect.Field;

public class Wtf {
public static void main(String[] args) throws Exception {
String alma = "alma";
String korte = "alma";
Field value = String.class.getDeclaredField("value");
value.setAccessible(true);
value.set(alma, new char[] { 'k', 'o', 'r', 't', 'e' });
System.out.println(korte);
}
}

Jul 15, 2012, 9:44:53 AM


Posted to Why String is Immutable or Final in Java? Explained

Google apps
Main menu