File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

static class variable

 
amit sanghai
Ranch Hand
Posts: 231
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
amit sanghai
Ranch Hand
Posts: 231
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this specific to SUN JVM, because there is nothing mentioned about .class in the Java API.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, class literals are part of the language specification:
http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#251530
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic