title: How to copy an object state into another object partially in java
body: <p>i want to copy one object state into another object as partially.</p>
  
  <p><strong>Class</strong></p>
  
  <pre><code>public class Fruit {
  
      private String name;
      private String price;
      private String taste;
  
      public Fruit()
      {
  
      }
  
      public String getName() {
          return name;
      }
      public void setName(String name) {
          this.name = name;
      }
      public String getPrice() {
          return price;
      }
      public void setPrice(String price) {
          this.price = price;
      }
      public String getTaste() {
          return taste;
      }
      public void setTaste(String taste) {
          this.taste = taste;
      }
  
  }
  
  main()
  {
  Fruit fruit1=new Fruit();
  fruit1.setPrice("50");
  fruit1.setTaste("sweet");
  Fruit fruit2=new Fruit();
  fruit2.setName("Apple");
  // i want to copy price and taste property values to same properties of fruit2 object like update how do i do that
  }
  </code></pre>
  
  <p>i want to only copy price and taste properties to fruit 2 </p>
  
  <p>i want to copy part of the state to another object without affecting its state</p>
  
  <p>how do i do that please let me know correct way to do that?</p>