Linked Questions

1 vote
1 answer
552 views

I have thoughts about the following design public void cntDownPossesion() { ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { ...
java's user avatar
  • 1,165
0 votes
2 answers
251 views

From Java documentation: Local classes are classes that are defined in a block, which is a group of zero or more statements between balanced braces. You typically find local classes defined in ...
Taisa's user avatar
  • 26
210 votes
4 answers
72k views

Is Eclipse's Java compiler just a wrapper around the same core that the javac program is wrapped around, or is it a separate compiler altogether? If the latter, why would they reinvent the wheel?
Bart van Heukelom's user avatar
4 votes
9 answers
3k views

I've read elsewhere that a static anonymous class doesn't make sense - that all anonymous classes should be tied to an instance of the enclosing type. But the compiler let's you do it. Here's an ...
user avatar
19 votes
1 answer
6k views

Take the following example: public void init() { final Environment env = new Environment(); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { env....
Joel's user avatar
  • 30.3k
2 votes
2 answers
2k views

I know it depends on the context in which the anonymous class has been written (static or non static method). but look this part of code: public class A { int fieldOfA; private static class ...
Giovanni Far's user avatar
  • 1,643
1 vote
1 answer
3k views

I'm trying to run the Label propagation protocol on my Apache Flink Gelly Graph. Here is my code: Graph<String, Long, String> ugraph = Graph.fromDataSet(vertex, edgeSet, env)....
Nesrine Doghri's user avatar
2 votes
3 answers
386 views

(I keep re-reading that question title and thinking about how ridiculous it must look, but I assure you that is the best description of the problem, and I have an actual application where this is the ...
snickers10m's user avatar
  • 1,749
1 vote
2 answers
1k views

I have a local variable in my outer method that I want to change from an anonymous inner class. How can I do it? I tried the solution using a one element array described here public class ...
J. Doe's user avatar
  • 135
3 votes
1 answer
211 views

Sometimes for testing I use quick "double-brace" initialization which creates anonymous nested class in Outer class, for example: static final Set<String> sSet1 = new HashSet<String>() { ...
kiruwka's user avatar
  • 9,510
1 vote
1 answer
250 views

I have a static BorderPane with ContextMenu insight Task Task task = new Task() { @Override protected Void call() throws Exception { ...
Peter Penzov's user avatar
  • 1,094
3 votes
1 answer
188 views

In Java, is there a way to explicitly prevent an anonymous class to reference the outer class or method's members/local variables?
Pinch's user avatar
  • 2,908
0 votes
3 answers
213 views

I want to understand better the visibility of instance fields of containing class to an Anonymous inner class (AIC). There have been lots of talks that AIC has an implicit reference to the containing ...
saurabh.in's user avatar