What is generic classes In Java
Anonymous
public class GenericClass { T obj1; U obj2; GenericClass(T obj1, U obj2) { this.obj1 = obj1; this.obj2 = obj2; } public void print(){ System.out.println(obj1); System.out.println(obj2); } public static void main(String args[]){ GenericClass s = new GenericClass("asdf",23); s.print(); } }
Check out your Company Bowl for anonymous work chats.