In Java, can “void” be considered a primitive type?

后端 未结 7 1072
-上瘾入骨i
-上瘾入骨i 2021-01-17 10:21

I\'ve noticed eclipse JDT uses void as a primitive type. Can this be considered correct?

7条回答
  •  没有蜡笔的小新
    2021-01-17 10:46

    here is what written in javadoc you referenced:

    Type code for the primitive type "void". Note that "void" is special in that its only legitimate uses are as a method return type and as a type literal.

    Pay attention on the bold word. I think this explains everything.

提交回复
热议问题