Can't you just debug it on your own now? Try to find out the behaviour of your program by placing PRINT statements after each statement and find it's behaviour.
Type: Posts; User: Mr.777
Can't you just debug it on your own now? Try to find out the behaviour of your program by placing PRINT statements after each statement and find it's behaviour.
Yeah, so think logically, set before getting. Or simply remove x.getX() from the parametrized constructor.
x=getX();
What's this line doing? Say, you are passing -20 to x in the parametrized(yours second) constructor and getX() will return you x's value that will be 0 as you didn't yet set.
Yes the first one is constructor of class Shape but not the second one.
Constructor has no return type, neither void.