This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes static class variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "static class variable" Watch "static class variable" New topic
Author

static class variable

amit sanghai
Ranch Hand

Joined: Dec 05, 2000
Posts: 231
I have seen some people use implicit static "class" variable to get the name of a class.
eg.
if class name is Demo , then what is "Demo.class"
Roger Goerke
Greenhorn

Joined: Sep 16, 2002
Posts: 9
Demo.class is a java.lang.Class object. It's name is Demo. If you toString() it you will get
class <package>Demo
For each defined Java class in a JVM there is one (and only one) Class object.


Yes. Shrubberies are my trade. I am a shrubber. <br />My name is 'Roger the Shrubber'.<br />I arrange, design, and sell shrubberies.
amit sanghai
Ranch Hand

Joined: Dec 05, 2000
Posts: 231
Is this specific to SUN JVM, because there is nothing mentioned about .class in the Java API.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
No, class literals are part of the language specification:
http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#251530


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: static class variable
 
Similar Threads
I am confused abt this code
can anyone explain me this?
explanation needed
Doubt on Inner class
Is there a debug flag in java?