Hi what is the proper way of achieving the task:
"The BigHall class must be a descendant of the Building.Hall class."
I have done it this way:
public class BigHall extends Building.Hall {
public BigHall(Building b){
b.super(null);
}
But I am not sure to be honest
what is the popper way?
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Guadalupe Gagnon
28 October 2019, 13:30useful
https://javaconceptoftheday.com/inheritance-inner-classes-java/
I'm not 100% sure because it has been a long time since i have done these tasks, but typically you shouldn't be passing null to the constructor that does something. The constructor of BigHall should take in a big decimal. Also not that the classes are nested behind Solution as the upper most class.
+1
Luyi
28 October 2019, 19:48
yep, you are right, thank you;
public class BigHall extends Building.Hall {
BigDecimal bigDecimal = new BigDecimal(10);
public BigHall(Building b){
b.super(bigDecimal);
}
Now I got it, the problem on my side was when I run above snippet of the code, the assigment of bigDecimal should be outside of the class; therefore I have used the null for the constructor
+1