java.lang.Void is analogous to java.lang.IntegerInteger is a way of boxing values of the primitive type intVoid is a way of boxing values of the primitive type void.

"But wait, void doesn't have any possible values!"

Right! That's what makes java.lang.Void "uninstantiable". :)

It's a nice feature of the Java type system that every primitive type has a boxed equivalent. inthas Integerlong has Longbyte has Byte... and void has Void. It would be weird and asymmetrical if Void didn't exist.

"So what's the difference between java.lang.Void and void?"

Easy. void is a primitive type. Void is an reference type that inherits from Object. They're similar in that neither of them has any possible values; but nevertheless they are two very different types, from the type system's point of view.

"But I don't have any use for Void in my programs."

And I don't have any use for GarbageCollectorMXBean in mine. Some features don't have non-obscure uses. That's okay.

The only point of Void is to hold Void.TYPE, which is sort of like void.class. If you have a reflective reference to a method that returns void, and you get its return type, it'll return Void.TYPE.

最新文章

  1. sphinx全文检索功能 | windows下测试 (一)
  2. C++ Primer----智能指针类 2
  3. LINUX下WIFI默认连接
  4. hdu4738 Caocao's Bridges
  5. atitit.web 推送实现方案集合(2)---百度云,jpush 极光推送 ,个推的选型比较.o99
  6. 在Linux上安装Oracle RAC 12 c(12.1) 虚拟机,一步一步向导
  7. comboBox的id返回System.Data.DataRowView
  8. qt 5 小练习 简易画板
  9. QMAKESPEC环境变量详解
  10. MySQL入门笔记(二)
  11. luogu2402 奶牛隐藏
  12. /VAR/LOG/各个日志文件分析
  13. PID控制示例C编程
  14. babel7-按需加载polyfill
  15. SpaceVim中vimproc的vimproc_linux64.so未找到
  16. springboot 没有跳转到指定页面
  17. Hbase记录-HBase增删改查
  18. xmind指定32位jdk解决在64位系统上不能启动的问题
  19. &,~,|,^
  20. JVM可支持的最大线程数

热门文章

  1. 【费用流】BZOJ1927-[Sdoi2010]星际竞速
  2. 升级到php7和安装拓展(mac centos)
  3. php操作redis出现不报错就退出
  4. poj 2528 Mayor's posters 线段树区间更新
  5. system.ComponentModel.Win32Exception (0x80004005): 目录名无效。 解决方法
  6. Windows UWP开发系列 – 控件默认样式
  7. Get buck-boost performance from a boost regulator
  8. 《C++反汇编与逆向分析技术揭秘》之11——虚函数
  9. go语言基础之类型转换
  10. Dockerfile命令