Monday, October 19, 2009

Pg. 340 Exercise 5

public class Car5{
private String make;
private int year;
private String color;

public Car5(){
}//end default constructor

public Car5(String m, int y, String c){
this.make = m;
this.year = y;
this.color = c;
}//end constructor

public boolean copyTo(Car5 newCar){
if(newCar.make == this.make && newCar.year == this.year && newCar.color == this.color){
return false;
}else{
return true;
}//end of if else statement
}//end of copyTo method
}//end of Car5

No comments:

Post a Comment