• 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

Void Wrapper Class

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Has anyone of you used the Void wrapper class ? I read that it does not wrap any primitive data type but it is used to represent void keyword. I'm curious to see some code using this class

Thanks In Advance,
Abhimanyu
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only place it's used is in the Java Reflection API. There's a class java.lang.reflect.Method, which Java uses to represent a Java method. You can ask a Method object what its return type is. It answers by returning a Class object. The Void class contains the constant Void.TYPE which is used to represent "void" in this context. That's it -- you're actually not allowed to create an instance of Void, so there's really nothing else this class can be used for.
[ November 05, 2004: Message edited by: Ernest Friedman-Hill ]
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think I've ever written a program that uses it. The primary use I see, though, is reflection. If you are interested in exploring this further, you should learn more about the Java Reflection API. I'm sure you can also use the Search utility here at the Big Moose Saloon to find previous discussions on reflect.

HTH

Layne
 
You don't like waffles? Well, do you like this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic