Generics (Generic) can address the security of data types by identifying the type of a property in a class or the return value and parameter type of a method at the time of class declaration by means of an identity.
Defined:
Access Permissions class class name < generics 1, generic 2...>{
Property
Method
}
Object is created:
Class name < concrete type > object Name =new class name < concrete type > ();
Defines a point class to represent coordinates, requiring that the data type of the coordinates be integers, decimals, and strings, since there are three kinds of coordinate value data types, then only the object type is received. However, when the coordinates are taken out, there is a risk of a downward transition, and it is not easy to find it during compilation and only throws an exception during run time.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6C/DF/wKioL1VUyQ_RkUD7AACmdAw47X0190.jpg "title=" 20131120133812750.jpg "alt=" Wkiol1vuyq_rkud7aacmdaw47x0190.jpg "/>
This article from "It Technology Learning and communication" blog, declined reprint!
Java generics in-depth explanation