title: How to print parameters of new object?
body: <p>I don't understand some example in Java.</p>
  
  <pre><code>public class Pair {
    private int a;
    private int b;
    public Pair(){
  
    }
  
    public Pair(int x, int y) {
      a = x;
      b = y;
    }
  
  }
  </code></pre>
  
  <p>Second class</p>
  
  <pre><code>   public class First extends Pair {
       public First(int x, int y) {
         super(x,y);
       }
  
       public static void main(String[] args) {
         Pair pair = new Pair(10,11);
         String s = "It is equal " + pair;
         System.out.println(pair);
       }
  
   }
  </code></pre>
  
  <p>Because it's used concatenation of strings, automatically it will be called method toString() from class Pair,
  so the result should be: "It is equal (10,11)".
  It prints me location in memory why?<br>
  Maybe I should call method like:</p>
  
  <pre><code>public void show(){
  System.out.println(a + "" + b);
  }
  </code></pre>
  
  <p>However in example there isn't method show(), there is only String s like above.</p>