What is "type" as stated in the Java tutorial?

Source: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html

You can also use the term "member" sometimes. The fields of a type, methods, and nested types are collectively referred to as its members.

The term type is used when defining a member in the tutorial, in this context it is not like a data type. I cannot find the correct definition on google. Maybe something obvious that I'm missing?

+3


source to share


3 answers


In this context, "type" means "class".



In other contexts it can mean "class or primitive type", but because they talk about types that have members, they mean classes specifically. The same is true for nested types: only classes can be nested inside other classes; all primitive types are built into the language and cannot be nested.

+8


source


It looks like they mean the class of the object.



+4


source


Java has 3 types.

  • ReferenceType - classes, interfaces and arrays

  • PrimitiveType - primitives

  • NullType - null

They are defined in the Java 4.1 Language Specification . Every time you see an API document or tutorial related to type

, this is what they are talking about.

In this particular case, the tutorial uses the type to refer to the ReferenceType. A class and interface (type) definition usually also defines the members of that type.

+2


source







All Articles