• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.Void

 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Can someone please give me a sample example on how to use java.lang.Void class??

Thanks.
 
Henry Wong
author
Sheriff
Posts: 22516
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its main use is as part of the reflection libraries. There is a static Class instance variable which is used to represent a void return value.

Henry
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Henry. Can you give me an example in code if possible?
 
Henry Wong
author
Sheriff
Posts: 22516
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, if you know how to use the reflection libraries, then you should know how to use the Void class. (considering all it is, is a place holder for the void class type)

If you don't know how to use the reflection libraries, maybe the Sun reflection tutorial is a good place to start.

http://java.sun.com/docs/books/tutorial/reflect/index.html

Henry
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will do that Henry Thanks.
 
Bert Bates
author
Sheriff
Posts: 8919
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For anyone who is focused on the SCJP exam, you can relax - none of this is on any version of the exam.
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are the Author of the HeadFirst and certification Java books right wow.. nice to meet you sir. Thanks for the reply.
 
Rob Spoor
Sheriff
Posts: 20817
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's Bert alright. The guy helped me pass both my SCJP exams
Well, with Kathy Sierra of course, who is also a member of this board.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!