说明下面代码是否存在错误,如果存在,请指出具体错误

public class ClassB {

ClassA classA=new ClassA(0, 0);

public ClassB() {}

public synchronized void setValues(int height, int wifth) throws IllegalAccessException{
    if(height<0||wifth<0)throw new IllegalAccessException();
    classA.height=height;
    classA.wifth=wifth;
}
public synchronized ClassA getValues(){
    return classA;
}

}

你没有指出classA和classB之间的关系,我无法看到classA是什么,并且你在classB中设置值和获取值都是和classA有关的,这样的做法无法理解。
还有,你的函数为什么总是加上synchronized,不明白。

如果A类没写错的话,这代码没错。