what is MyClass.class?
<p>following is the code listed in MainClass.java.</p>

<pre><code>public class MainClass {

    public static void main(String[] args) {

     System.out.println("main started...");

     Class c = MyClass.class ;
                        //this class variable seems to be public static.
                        //But, as it is clearly visible in the MyClass,
                        //no reference variable is declared.
                        //My problem is that from where this class variable
                        //came from.
                        //i also check out the Object.java file, but it also don't
                        //have any public static class variable of Class class
                        //like there is
                        //out (instance of PrintStream class) in System class.
                        //Hope all u mindoverflow guys help me to sort out
                        //this probz.

     try {
      Class.forName( c.getName() ) ;

      System.out.println("classloader of MyClass : " + MyClass.class.getClassLoader());

      System.out.println("classloader of MyClass : " + String.class.getClassLoader());
     } catch (ClassNotFoundException e) {
      e.printStackTrace();
     }

     System.out.println("main ended...");
    }
}

class MyClass{
    static{
     System.out.println("static block of MyClass class.");
    }
}
</code></pre>

<p>thnx coobird...
i found the article quite useful. :)</p>

<p>But, about litereals my knowledge is only limited to:</p>

<pre><code>int i = 5 ;  //here 5 is an integer literal

float f = 5.6f ;  //here 5.6f is a float literal
</code></pre>

<p>the only non-primitive litereal, i know is</p>

<pre><code>String str = "java" ;   //"java" is a String litereal
</code></pre>

<p>and class literal, which u and Jon Skeet make clear to me very well.</p>

<p><strong>are there more literals found in java???</strong></p>

<p><hr /></p>

<p>agreed...
so as per the discussion, total literals are categorized as:-</p>

<ul>
<li>primitive literals</li>
<li>string literals </li>
<li>class literal</li>
<li>null</li>
</ul>

<p>are there some more literals (to make the list a little longer <strong>:)</strong> )</p>

<p><hr /></p>

<p><strong><em>when i decompile the MainClass.class using decomipler, two Class
type static variables (may be coz, i have used class literal 2 times) are found to be automatically added, but never found to be used
in the code. Also, both the class literals are directly replaced from the class file where i have used them in the java file.</em></strong></p>

<p><strong>My code :-</strong></p>

<pre><code>public class MainClass {

    public static void main(String[] args) {

        System.out.println("main started...");

        Class c = MyClass.class ;

        try {
            Class.forName( c.getName() ) ;

            System.out.println("classloader of MyClass : " + MyClass.class.getClassLoader());

            System.out.println("classloader of MyClass : " + String.class.getClassLoader());
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

        System.out.println("main ended...");
    }
}
</code></pre>

<p><strong>Decompiler generated code :-</strong></p>

<pre><code>import java.io.PrintStream;

public class MainClass
{

    public MainClass()
    {
    }

    public static void main(String args[])
    {
        System.out.println("main started...");
        Class c = MyClass;
        try
        {
            Class.forName(c.getName());
            System.out.println((new StringBuilder("classloader of MyClass : ")).append(MyClass.getClassLoader()).toString());
            System.out.println((new StringBuilder("classloader of MyClass : ")).append(java/lang/String.getClassLoader()).toString());
        }
        catch(ClassNotFoundException e)
        {
            e.printStackTrace();
        }
        System.out.println("main ended...");
    }

    static Class class$0;
    static Class class$1;
}
</code></pre>
