package mariaJava;

public class Fruit {

	private final String color;
	private final int weight;
	private String kind;
	private int weight2 = 2;
	
	public Fruit(final String color, final int weight) {
		this.color=color;
		this.weight=weight;
		System.out.println("You can't change a final parameter. Compiler error in constructor.");
//		weight++; //Compiler error
	}
	
	public Fruit(String color, int weight, String kind) {
		this.color=color;
		this.weight=weight;
		System.out.println("Weight is set to " + weight + " in constructor.");
		weight=weight+20; //This will NOT affect the calling variable
		System.out.println("Changing weight to " + weight + " in constructor");
	}
	
	public int getWeight() {
		return weight;
	}
	
	public int getWeight2() {
		return weight2;
	}

}
