I'm working through book examples about JavaBeans and this is my first attempt. My code is:
package com.wrox.cars;
import java.io.Serializable;
public class CarBean implements Serializable {
public CarBean () {
}
private String make = "Ford";
public String getMake() {
return make;
}
public void setMake(String make) {
this.make = make;
}
}
I'm unable to compile my code because of the error:
/begjsp-ch04/CarBean.java:1: 'class' or 'interface' expected
package com.wrox.cars;
^
/begjsp-ch04/CarBean.java:3: 'class' or 'interface' expected
import java.io.Serializable;
^
2 errors
I copied this code directly from the book. Does the package mean that it won't compile anywhere but that location? I need some guidance, thanks.