Java Internal classes:
Http://www.cnblogs.com/dolphin0520/p/3811445.html
android.blog.51cto.com/268543/384844/
External classes can access private members of internal classes.
When passing parameters, it is best to use final.
Final parsing:
Http://www.cnblogs.com/dolphin0520/p/3736238.html
Array copy: public static void Arraycopy (object src, int srcpos, object dest, int destpos, int length)
String:
The most common way to create and initialize a string object in Java is in two ways:
String Str=new string ("XXX");
String str= "XXX";
The former is the standard method of object creation in Java, and the objects created will be placed directly into the heap, and a new object will be created for each call, and the latter will create an object reference variable str in the stack, and then see if there is a "xxx" in the string pool, and if not, store "xxx" in the string pool. and makes the reference variable str point to it, and if it already has "XXX", direct str to it. This makes full use of the data sharing advantages of the stack, and of course it can be a trap where objects are likely not created, but point to a previously created object, and the new () method guarantees that a new object is created each time.
Sort objects:
@Overridepublic int compareTo (Object o) {particle ptmp = (particle) o;int flag = fitness > ptmp.fitness? 1: -1;return Flag;}
Object Output Overloading:
1 @Override2 PublicString toString () {3String ret =NewString ();4RET + = "v=";5 for(inti = 0; I < Dim; ++i) {6RET + = "" +V[i];7 }8RET + = "pos=";9 for(inti = 0; I < Dim; ++i) {TenRET + = "" +Pos[i]; One } ARET + = "fit=" +Fitness; - returnret; -}
View Code
Java learning inner class and final