What is the output?
public class Tree {
private String color; // Instance variable to hold the color of the tree
// Constructor to initialize Tree objects with a color
public Tree(String color) {
this.color = color;
}
// Method to change the color of one tree to the color of another
public static void change(Tree t1, Tree t2) {
String color = t2.getColor();
t1.setColor(color);
}
// Accessor method to get the color of the tree
public String getColor() {
return color;
}
// Mutator method to set the color of the tree
public void setColor(String color) {
this.color = color;
}
// Main method to run the program
public static void main(String[] args) {
Tree olive = new Tree("Green");
Tree almond = new Tree("Brown");
change(olive, almond);
System.out.println(olive.getColor()); // This will print "Brown"
}
}