In the stack using Eclipse, sometimes I saw
Manager$2.run() line : 278
What does $2 mean here?
It is anonymous class.
An anonymous class is a local class without a name. An anonymous class is defined and instantiated in a single succinct expression using the new operator.
From the method name, it might be a Runnable.run() method.
public class Manager {
public static void main(String[] args) {
new Manager();
}
public Manager() {
// this is anonymous class
// |
// V
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
System.out.println("hi");
}
});
thread.start();
}
}
See
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With