1. Engineering
  2. Computer Science
  3. 5 the following program contains several errors that violate the...

Question: 5 the following program contains several errors that violate the...

Question details

5. The following program contains several errors that violate the rules of Java: 1. public class ColoredPoint extends Point implements Col 2. 3. 5 private String color; public ColoredPoint (int x, int y, int color)f super(x,y); this.color-color 7. public String getcolor( 9. 10. public String tostringO 12. return color return super.tostring)+ Color: +color; public boolean equals(Object o)t 13. 14. 15. 16. if (o instanceof ColoredPoint) ColoredPoint other o; return color equals(other.color) return false else f 18. 19. 29. 21. Locate all the errors and specify whether each one is (a) lexical, (b) syntactic, or (c) semantic. Use the numbers shown to identify the line on which each error occurs. The program may also contain programming errors that do not violate the rules of Java and will not be detected by a Java compiler. You should ignore these errors.
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution