Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #14040
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.erje.net!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Sun, 29 Apr 2012 18:13:43 -0500 |
| Date | Mon, 30 Apr 2012 00:13:33 +0100 |
| From | Neil Morris <neil.morris4@googlemail.com> |
| Reply-To | neil.morris4@googlemail.com |
| User-Agent | Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.java.programmer |
| Subject | generics |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Message-ID | <Ha6dnQN32-O6VgDSnZ2dnUVZ8q-dnZ2d@brightview.co.uk> (permalink) |
| Lines | 26 |
| X-Usenet-Provider | http://www.giganews.com |
| X-Trace | sv3-47g9fcZ8hmeqy7vKZAKqsoCLQS01rg1DGchx1XMdH0/a17BD4KpFK4YuHvIuMlcpKtesgakO3+FDn/T!y7js5gsWaQouzLwBq4rWI/M1/l6Qg06kGCOq/1o0Dg/LAh6XtMRaS6fPQ35D33woRCrGJeMrtC1X!zKOGKfsh/xeCO1Z858bMpbH1ig== |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 1635 |
| Xref | csiph.com comp.lang.java.programmer:14040 |
Show key headers only | View raw
Dear newsgroup
With the following code, what is the difference from one written with
Bounded Type Parameters? the code has type 'Number' with the 'add'
method using the 'Integer' type. How can I stop a subtype from being
passed to the 'add' method?
public class Test<T> {
private T t;
public void add(T t) {
this.t = t;
}
public T get() {
return t;
}
public static void main(String[] args) {
Test<Number> test = new Test<Number>();
test.add(new Integer(10));
System.out.println(test.get());
}
}
thanks in advance
Neil
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
generics Neil Morris <neil.morris4@googlemail.com> - 2012-04-30 00:13 +0100
Re: generics Arne Vajhøj <arne@vajhoej.dk> - 2012-04-29 19:39 -0400
Re: generics Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-04-29 16:48 -0700
Re: generics markspace <-@.> - 2012-04-29 17:48 -0700
csiph-web