• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Object obj = Boolean.class

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Object obj = Boolean.class;

Could any one explain me how this statement is valid?
 
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whats the problem with that,
the statement Boolean.class object of type class Class
and since Object is the super class of every object. So this has to be valid
 
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
also make a note:
Boolean.class IS-A Object //true
Boolean.class IS-A Class //true
Boolean.class IS-A Boolean //false

an FYI

amit
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To continue the theme:
Boolean.class IS-A Class<Boolean>
Boolean.class IS-A Class<? extends Boolean>
Boolean.class IS-A Class<? extends Comparable<Boolean>>
Boolean.class IS-A Class<? extends java.io.Serializable>
Boolean.class IS-A Class<? extends Object> (redundant, see below)
Boolean.class IS-A Class<? super Boolean>
Boolean.class IS-A Class<?>
X<? extends Object> is redundancy and should be replaced with X<?> (for all X)
[ April 27, 2005: Message edited by: Tony Morris ]
 
No holds barred. And no bars holed. Except this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic