GeeCON Prague 2014*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Class litral ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Class litral ??" Watch "Class litral ??" New topic
Author

Class litral ??

R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
From JLS:
Names of types are used in declarations, casts, class instance creation expressions, array creation expressions, class literals, and instanceof operator expressions.
---------------------------------------------------------------
What is class litral?
------------------
Regards
Ravish


"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
Double.class
Object.class
Class.class

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
U mean Double.class is from wrapper class Double & so on.?
Bye
Viki.
------------------
Count the flowers of ur garden,NOT the leafs which falls away!


Count the flowers of your garden, NOT the leafs which falls away!
Prepare IBM Exam 340 by joining http://groups.yahoo.com/group/IBM340Exam/
Rosie Nelson
Ranch Hand

Joined: Nov 06, 2001
Posts: 31
A class literal is an expression consisting of the name of a class, interface, array, or primitive type followed by a `.' and the token class. It evaluates to an object of type Class, the class object for the named type (or for void).
For reference types, a class literal is equivalent to a call to Class.forName with the appropriate string, except that it does not raise any checked exceptions. (Its efficiency is likely to be comparable to that of a field access, rather than a method call.) The class literal of a reference type can raise NoClassDefFoundError, in much the same way that a class variable reference can raise that error if the variable's class is not available.
The class literal of a primitive type or void is equivalent to a static variable reference to a pre-installed primitive type descriptor, according to this table:
boolean.class == Boolean.TYPE
char.class == Character.TYPE
byte.class == Byte.TYPE
short.class == Short.TYPE
int.class == Integer.TYPE
long.class == Long.TYPE
float.class == Float.TYPE
double.class == Double.TYPE
void.class == Void.TYPE


R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
Hi Rosie Nelson
can you tell me the source from where you get this knowledge ??
Thanks in advance.
------------------
Regards
Ravish
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
JLS 15.8.2
In the API
look at java.lang.Integer in the Field Section. You have

static Class TYPE
The Class object representing the primitive type int.

And the same goes for the other wrapper classes.
HIH

------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
Thanks Valentin
Now another:
the class object for the named type (or for void).
does Java support void ??
------------------
Regards
Ravish
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
java.lang.Void.
What do you mean by does Java support void ?
HIH
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
Thanks Valetin
I have to dig more
now agian going to hibernate... will come back soon... but I do check this forum though I do not reply or post que.(Last week I controlled a lot.... )
Actually I read some where that you can not cast any thing to void like we do in 'C'.....
will be back

------------------
Regards
Ravish
 
GeeCON Prague 2014
 
subject: Class litral ??