/*
Review Spare:
Generic methods and static methods generic generic class definitions are valid for the entire class if the object of the generic class is used by the method, then all types that are to be manipulated are fixed so that different methods can manipulate different types and the types are undefined Generics can then be defined on a method by a static method generic: A static method cannot access a generic defined on a class if the application data type for a static method operation is undefined, you can define the generic on the method*/classDemo<t>{ Public voidmethod (T-t) {System. out. println ("Method:"+t); } Public Static<W>voidStaticmethod (w) {System. out. println ("Staticmethod:"+W); } Public<K>voidShow (k k) {System. out. println ("Show:"+k); } Public<Q>voidprint (q q) {System. out. println ("Print:"+q); }}classtestdemo{ Public Static voidmain (String [] arags) {Demo<Double> d =NewDemo<double>(); D.method (3.4); D.staticmethod (true); D.show ("haha"); D.print (NewInteger (4)); }}
JAVA generic methods and static method generics