Can any One help me , why this program is not working..?
public class Vehicle { private String color; Vehicle() { this.setColor("Red"); } Vehicle(String c) { this.setColor(c); } // Setter public void setColor(String c) { this.color = c; } // Getter public String getColor() { return color; } } public class Program { public static void main(String[] args) { //color will be "Red" Vehicle v1 = new Vehicle(); //color will be "Green" Vehicle v2 = new Vehicle("Green"); System.out.println(v2.getColor()); } } // public class Name{ // private String name; // Name(){ // this.setName("Krishna"); // } // Name(String n){ // this.setName(n); // } // //Setter // public void setName(String n){ // this.name = n; // } // //Getter // public String getName(){ // return name; // } // public class Program{ // public static void main(String[] args){ // Name n1 = new Name(); // //System.out.println("The Name : "+n1.getName()); // Name n2 = new Name("Prasad"); // System.out.println("The Name : "+n2.getName()); // } // } // }