title: Could someone explain me the .getClass() method in java
body: <p>I am currently taking a java class in university. This is my first programming class and I've stumbled on something that I just cannot understand. As i learned, there are two ways of comparing variables. The first is using the <code>==</code>, <code>!=</code>, <code>&lt;</code>, <code>&gt;</code> , <code>=&lt;</code> , <code>&gt;=</code>  signs for PRIMITIVE variables such as int,double,etc. and the second way is to use the .equals() method for reference type. Now here is my question:</p>
  
  <p>When I use the <code>.getClass()</code> method, I can compare two classes with the .equals() method and the <code>==</code> / <code>!=</code> method. Since I can use the <code>==</code>/<code>!=</code> signs, I'd suppose that the <code>.getClass()</code> method which returns the class of an object must return a primitive type. But searching on google the only thing I found out about this method in the java API is that it returns the class of an object. It doesn't tell me the variable type it returns. How exactly does this method work. What does it return? I tried to ask my teacher but she didn't know. Thank you!</p>