title: Inherting values friom one object to another
body: <p>i have this code here.Tuple is a class using (int,int) as keys to find a specific object.I have overrided hashcode and equals because if i have a specific (x,y) value i want to be able to compare it.</p>
  
  <pre><code>import java.lang.Math; 
  import java.io.*;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.List;
  import java.util.LinkedList; 
  import java.util.Queue; 
  import java.util.*;
  
  
  class Tuple {
        public Tuple (int x, int y) {
          this.x = x;
          this.y = y;
        }
        public String moves;
       public int  times;
        public int getX(){
              return this.x;
  
          }
          public int getY(){
              return this.y;
  
          }
  
        @Override
        public int hashCode() {
          int hash = 17;
          hash = 5 * hash + this.x;
          hash = 5 * hash + this.y;
          return hash;
      }
        @Override
          public boolean equals(Object o) { 
              if (o == this) { 
                  return true; 
              }   
              if (!(o instanceof Tuple)) { 
                  return false; 
              } 
              Tuple c = (Tuple) o; 
              return Double.compare(x, c.x) == 0
                      &amp;&amp; Double.compare(y, c.y) == 0; 
          } 
        private int x;
        private int y;
      }
  
  
  
  
  public class HelloWorld
  {
  
    public static void main(String[] args)
    {
      Tuple t2=new Tuple(1,1);
      t2.moves="aaa";
  
      Tuple t1=new Tuple(1,1);
      System.out.print(t1.moves);
    }
  }
  </code></pre>
  
  <p>Is there a way to inherit t1.moves to t2.moves without knowing the actual t1 object and only by having (1,1)?Should String moves be public in order to achieve that?</p>