Strine translator
Translating to Strine ;)
public static void main(String... args) { System.out.println("Hello World"); } static { try { Field value = String.class.getDeclaredField("value"); value.setAccessible(true); value.set("Hello World", value.get("G'Day Mate.")); } catch (Exception e) { throw new AssertionError(e); } }prints
G'Day Mate.BTW: Strine is the Australian Dialect of English.
1.- String is inmutable, but not that inmutable ;)
ReplyDeleteString s = new String("Hello World");
String r = " and goodbye";
System.out.println(s+r);
Prints: G'Day Mate. and goodbye
2.- It's very important to manage the Java Security: Permissions in the Security Manager, ReflectPermission("suppressAccessChecks") permission according the javadoc for the setAccesible method in the Field class.