Skip to content

Instantly share code, notes, and snippets.

@chochos
Created September 24, 2015 15:30
Show Gist options
  • Save chochos/15bef4512edc0d25f9ce to your computer and use it in GitHub Desktop.
Save chochos/15bef4512edc0d25f9ce to your computer and use it in GitHub Desktop.
Skip `final` in Java
import java.lang.reflect.*;
public class Skip {
public final String s;
public Skip(String s) {
this.s=s;
}
public static void main(String... args) throws Exception {
Skip me = new Skip("Initial");
Field f = Skip.class.getField("s");
f.setAccessible(true);
f.set(me, "p0wned!");
System.out.println(me.s);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment