Friday, March 7, 2014

Write the constructor method, this is what is meant by ah


Runnable runnable == new Runnable () {
public void run () {
System.out.println ("runable");
}

}

Do not understand the meaning of the red part of the<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Anonymous inner class, you can view the details under
BaiduThe point is to create a simple excuse Runnable implementation class, run method must be rewritten;
This class does not need to know the name of the so called anonymous inner classes; This is the origin of the wording
Reply:
This is 100 points ... a lot of ah
Reply:
1st floor has been explained, in fact, this is not a constructor method is a class method, another way
public class TestRun implements Runnable {
public void run () {
System.out.println ("runable");
}
}
Reply:
Ah, this is not the constructor. Anonymous inner classes is so written. run method is actually inherited this anonymous inner class Runnable class to run replication.


Reply:

Anonymous inner classes have all been given an explanation LS
Reply:
LS god of positive solutions, anonymous inner classes
Reply:

No comments:

Post a Comment