Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Programmer Certification (OCPJP)
instanceof on a generic type valid?
Vishwanath Krishnamurthi
Ranch Hand
Posts: 331
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
Is it that an instance of check cannot be done with a generic type?
something like,
Basket a=new Basket(); Basket<Apple> ref=a; System.out.println("instance-of-check "+ a instanceof Basket<Apple> ;
I am right in thinking that this is illegal?
Thanks
[ December 14, 2007: Message edited by: Vishwa Nath ]
Blog
Keith Lynn
Ranch Hand
Posts: 2412
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Yes it is.
This is from the
Java
Language Specification 15.20.2.
It is a compile-time error if the ReferenceType
mentioned after the instanceof operator does not denote a reifiable
type.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Generic questions.
Generics Question
Generics method declaration confusion. Plz clarify
Hi
Generic doubt
More...