title: Changing Values in a Point
body: <pre><code>Point p1 = new Point(100, 100);
  Point p2 = new Point(300, 100);
  Point p3 = new Point(110, 100);
  int x3 = 310;
  Point p4 = new Point(100, 100);
  static JFrame start = new JFrame("Start");
  
  if(p3.x &gt;= start.getWidth()-90)
  {
      p3.x = (int) (p1.getX()+10);
      p3.setLocation(p3.x, p3.y);
      repaint();
  }
  
  if(key == KeyEvent.VK_S &amp;&amp; !paused)
  {
      p1.y++;
      p4.y++;
      p1.setLocation(p1.x, p1.y);
      test1.setBounds(new Rectangle(p1, new Dimension(64, 64)));
      repaint();
      sound.soundPlay(3);
  }
  </code></pre>
  
  <p>In this, the x value of point p3 is supposed to be the same as the value of p1.getX()+10. The value is changed to 100+10, but I have changed 100 to a different value in the second block. How do I update p1 in the first block to match the p1 in the second block?</p>