title: How to return a new object using a parameter in Java?
body: <p>I'm doing an homework question: </p>
  
  <p>"Each part of this question asks you to write a function that takes as a parameter one of the objects you created classes for in Q1, and does something with it. In Q2A write a method called cloneDog() that takes an object of type Dog and returns a new
  Dog object with the same name and breed, but with an age of 0, and that does glow green. The original dog should remain unharmed." </p>
  
  <p>I'm trying to return an object with different values in fields. I need to return the object without changing the values of the fields.</p>
  
  <p>My field is:</p>
  
  <pre><code>public class Dog
  {
      String name;
      int age;
      String breed;
      boolean glowsGreen;
  }
  </code></pre>
  
  <p>My Q1A Code is:</p>
  
  <pre><code>Dog getTegon()
      {
          Dog dog1 = new Dog(); 
          dog1.name = "Tegon";
          dog1.age = 2;
          dog1.breed = "Beagle";
          dog1.glowsGreen = false;
          return dog1;
      }
  </code></pre>
  
  <p>For Q2A, i don't know how to use the parameter for different values:</p>
  
  <pre><code>Dog cloneDog(Dog getTegon)
  {
  
      enter code here
  
  }
  </code></pre>