Jump to content

Talk:Wildcard (Java)

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Idleloop~enwiki (talk | contribs) at 18:46, 18 December 2011 (doubts 'bout code). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Code

May be wildcardReference should be better initialized?
If not, javac can complain with an error:

"variable wildcardReference might not have been initialized"

I would code it this way:

Generic<?> wildcardReference=new Generic(); // new Generic<>() prohibited as explained in section 'Object Creation with Wildcard'

--idleloop (talk) 18:46, 18 December 2011 (UTC)[reply]