Created
January 13, 2018 00:31
-
-
Save weibeld/a00bf08c05620616dc84bb0512d9a19b to your computer and use it in GitHub Desktop.
Class for JDB tutorial article on http://weibeld.net/java/debugging-with-jdb.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class A { | |
private int x; | |
private int y; | |
public A(int a, int b) { | |
x = a; | |
y = b; | |
} | |
public static void main(String[] args) { | |
System.out.println("Hi, I'm main.. and I'm going to call f1"); | |
f1(); | |
f2(3, 4); | |
f3(4, 5); | |
f4(); | |
f5(); | |
} | |
public static void f1() { | |
System.out.println("I'm f1..."); | |
System.out.println("I'm still f1..."); | |
System.out.println("I'm still f1..."); | |
} | |
public static int f2(int a, int b) { | |
return a + b; | |
} | |
public static A f3(int a, int b) { | |
A obj = new A(a, b); | |
obj.reset(); | |
return obj; | |
} | |
public static void f4() { | |
System.out.println("I'm f4 "); | |
} | |
public static void f5() { | |
A a = new A(5, 6); | |
synchronized(a) { | |
System.out.println("I'm f5, accessing a's fields " + a.x + " " + a.y); | |
} | |
} | |
private void reset() { | |
x = 0; | |
y = 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment