Guest User

Untitled

a guest
Aug 17th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. Java anonymous class and reachable private variable
  2. interface Test {
  3. public void test();
  4. }
  5.  
  6. public class TestMain {
  7. private String h = "AAA";
  8.  
  9. public static void main(String[] args) {
  10. TestMain t = new TestMain();
  11. }
  12.  
  13. public TestMain() {
  14. Test t = new Test() {
  15. public void test() {
  16. System.out.println( h );
  17. }
  18. };
  19.  
  20. t.test();
  21. }
  22.  
  23. }
Add Comment
Please, Sign In to add comment