我有一个抽象类“HotelReviewClass”和“RestaurantReviewClass”,我想在其中初始化不是 commun 和 commun 的变量去“超级”类
但是我有一个错误“构造函数调用必须是构造函数中的第一个语句”我如何初始化那些不常用的变量(因为“HotelReviewClass”和“RestaurantReviewClass”变量不相等)
package pt;
public class HotelReviewClass extends AbstractReview{
private String ratingService;
private String ratingLocal;
public HotelReviewClass(String grade, String comment, String service, String local, String owner){
this.ratingService = service;
this.ratingLocal = local;
super(grade, comment, owner);
}
}