> Hello,
>
[quoted text clipped - 8 lines]
> Also, The Java class Class really describes types. Would it have made
> more sense to call this class Type instead of Class?
<http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html>
> a Java type is a classification of what could potentially be bound
> to a Java variable
This works for me. I also think of type as how the JVM will interpret
any given bit pattern to which the variable is bound.
> Also, The Java class Class really describes types. Would it have made
> more sense to call this class Type instead of Class?
Hmm, but ints, chars, booleans and all the other primitives are also
types, but I don't think that Class describes them. Class only deals
with Java objects (most of the language, admittedly) but there are a few
types it doesn't abstract.
Also, generics are a type, but their type gets erased during
compilations. I don't think Class can represent the un-erased type.
Patricia Shanahan - 06 Sep 2007 18:05 GMT
>> a Java type is a classification of what could potentially be bound
>> to a Java variable
[quoted text clipped - 9 lines]
> with Java objects (most of the language, admittedly) but there are a few
> types it doesn't abstract.
Each of the wrapper types has a public static final TYPE field that
references the Class object for the corresponding primitive. For example:
"public static final Class<Integer> TYPE
The Class instance representing the primitive type int."
in class Integer. Class objects for primitives are important in some
reflection interfaces.
> Also, generics are a type, but their type gets erased during
> compilations. I don't think Class can represent the un-erased type.
I'm not sure generics count as a type, or anything else, in a running
program. They are effectively a form of compile-time assertion that
enables some extra checking.
Patricia
dave - 06 Sep 2007 19:42 GMT
> > Also, The Java class Class really describes types. Would it have made
> > more sense to call this class Type instead of Class?
[quoted text clipped - 3 lines]
> with Java objects (most of the language, admittedly) but there are a few
> types it doesn't abstract.
Although primitive types aren't objects, they can return a Class
object. Example:
Class cl = int.class; // int.class is an object of type Class
Jeff Higgins - 06 Sep 2007 20:46 GMT
>> > Also, The Java class Class really describes types. Would it have made
>> > more sense to call this class Type instead of Class?
[quoted text clipped - 8 lines]
>
> Class cl = int.class; // int.class is an object of type Class
<http://java.sun.com/docs/books/jvms/second_edition/html/Concepts.doc.html#23409>
Lew - 06 Sep 2007 22:35 GMT
dave wrote:
>>>> Also, The Java class Class really describes types. Would it have made
>>>> more sense to call this class Type instead of Class?
...
>> Although primitive types aren't objects, they can return a Class
>> object. Example:
>>
>> Class cl = int.class; // int.class is an object of type Class
Interfaces are also types, but not classes.
Class != type. Interface != type. Primitive != type.
Why are you interested in redefining the Java language? Is "class" such a bad
word?

Signature
Lew
dave - 07 Sep 2007 00:16 GMT
> Interfaces are also types, but not classes.
>
> Class != type. Interface != type. Primitive != type.
>
> Why are you interested in redefining the Java language? Is "class" such a bad
> word?
I'm not, I just asked if it made sense, it seemed logical to me,
although I admit I'm not a Java expert. In fact, you'll notice from
the title post I consider myself a Java "newbie", meaning there is no
way in hell I would think I'm smarter than the people at Sun who write
the Java specification!
My hope was to understand a bit more on exactly what types means in
Java.
Anyway, thanks especially Jeff Higgins for those links. Those pretty
much clear up the issues for me at least.
Jeff Higgins - 07 Sep 2007 02:37 GMT
I'm a newb2 and have had a lot of help from the good people
who frequent this group. I'm happy this "blind pig" was able to
help find an acorn.
JH
Mark Space - 07 Sep 2007 20:49 GMT
>>> Also, The Java class Class really describes types. Would it have made
>>> more sense to call this class Type instead of Class?
[quoted text clipped - 7 lines]
>
> Class cl = int.class; // int.class is an object of type Class
Well that's darn interesting. That's for pointing that out!
>Also, The Java class Class really describes types. Would it have made
>more sense to call this class Type instead of Class?
Classes apply only to Objects. Type would be Objects plus primitives.
Class has some kludges to describe primitives, but for the most part
it applies only to classes.
So I think either the name Class or Type would have been appropriate.

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com