Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. public class MyClass {
  2.  
  3. static class blah{
  4. public String password;
  5.  
  6. blah() throws Exception{
  7. password = "secret_password";
  8. throw new Exception();
  9. }
  10. }
  11.  
  12. static class Glah extends blah{
  13.  
  14. public Glah() throws Exception{
  15. super();
  16. }
  17.  
  18. @Override
  19. public void finalize(){
  20. System.out.println(password);
  21. }
  22. }
  23.  
  24.  
  25. public static void main(String args[]) {
  26.  
  27. try{
  28. Glah glah = new Glah();
  29. }
  30. catch(Exception ex){
  31. ex.printStackTrace();
  32. }
  33. System.out.println("Im here");
  34. System.gc(); //prints the password.
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement