按照讲解写了一遍,可以正常调用方法,可是一直提示构造函数未定义
怎么老是提示构造函数未定义?
public class Score{
private int score1;
private int score2;
private int allScore;
public int GetScore(){
return score1;
}
public void SetScore(int newScore1 ){
score1=newScore1;
}
public Score(int newScore1,int newScore2){
score1=newScore1;
score2=newScore2;
allScore=score1+score2;
System.out.println("成绩:"+allScore);
}
}
public class initailTelphone {
public static void main(String[] args) {
Score score3 = new Score();//这行总是出错,提示构造函数未定义
score3.SetScore(99);
System.out.println("成绩:"+score3.getClass());
}
}