bsodzik
unread,Nov 23, 2009, 2:25:10 PM11/23/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Poznań Java User Group
Czołem,
Na spotkaniu kombinowałem coś z konstrukcją <JakisTyp>nazwaMetody(),
tylko zapomniałem jaka była dokładna składnia. Poniżej fragment który
chciałem przedstawić:
public class Generic {
public <T> void doSth(T t) {
System.out.println(t);
}
public <T> void somePointlessMethod() { }
public static void main(String[] args) {
String o = new String("x");
//Object o = new Object(); //To juz nie zadziala
new Generic().<String>doSth(o);
new Generic().<Number>somePointlessMethod();
}
}
Myślę że warto zapamiętać że można używać takich konstrukcji. Mi
przynajmniej kiedyś to się przydało.
Pozdrawiam, Tomek