Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Void  RSS feed

 
shruthi Rao
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, Friends
Can any one Explain me what is the use of Void what it is meant for how it performs? and why it is used ?
THank u
............
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Void, with a capital "V" the class java.lang.Void? Or "void" with a small "v", the keyword?

"void" means "nothing". A method whose return type is "void" doesn't return any value at all.

The "Void" class has a related usage. Java has something called the "reflection API." You can use the reflection API to ask Java about a class, its methods, and data. Java responds by handing you objects of various types which describe the class. So, for example, you might have a java.lang.reflect.Method object. This object describes a particular Java method. You can ask it what types of arguments it takes, and you can ask it what its return type is. If you have a Method and it represents a method that returns void, and you ask that Method what the method's return type is, you'll get an instance of the class Void as a reply. That is the only purpose for the existence of this class!
 
shruthi Rao
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the class java.lang.Void
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!