title: How to check type of class in Java?
body: <p>I'm a newbie to <a href="https://www.java.com/" rel="nofollow noreferrer">Java</a>. I wrote a <a href="https://docs.oracle.com/javase/tutorial/java/concepts/class.html" rel="nofollow noreferrer">class</a> with a method, which checks the Object type. I did my initial search in google and it was difficult to understand the articles available online. I would appreciate any help. I know that line <strong>if(Object == dog)</strong> doesn't work. How could I fix this? </p>
  
  <pre><code>public class dog {
      private String name;
      private String rasa;
      private int waga;
  
      public dog(String name, String rasa, int waga) {
          this.name = name;
          this.rasa = rasa;
          this.waga = waga;
      }
      public void printdog()
      {
          System.out.println(this.name);
          System.out.println(this.rasa);
          System.out.println(this.waga);
          if(Object() == dog)
          {
              System.out.println("dunno how to woof");
          }
      }
  }
  </code></pre>