public class Box{
public int length,width,height;
public int volume;
Box(int i, int j, int k){
this.length=i;
this.width=j;
this.height=k;
}
void setvolume(int i){
this.volume=i;
}
int getvolume(){
return volume;
}
}
class BigBox{
Box B1=new Box(20,30,40);
B1.length=30;
}
I created a class Box and another class BigBox which overwrites the length variable of the object of the class Box to 30. But when I write the code B1.length=30 to overwrite it, it shows an error I am unable to understand. Can anyone help me out?