I want it to return new Dillo and print out the length of new Dillo. When I compile the code, it will say: Error: Unreachable code for the line System.out.println(this.length);
How can I fix this? Thank you
import tester.* ;
class Dillo {
int length ;
Boolean isDead ;
Dillo (int length, Boolean isDead) {
this.length = length ;
this.isDead = isDead ;
}
// produces a dead Dillo one unit longer than this one
Dillo hitWithTruck () {
return new Dillo(this.length + 1 , true) ;
System.out.println(this.length);
}
}
class Examples {
Examples () {} ;
Dillo deadDillo = new Dillo (2, true) ;
Dillo bigDillo = new Dillo (6, false) ;
}