Question: The following class contains several errors that violate the rules of Java: 1. class Thermometer { 2. private int temperature 3. public Thermometer(int degrees) {

 The following class contains several errors that violate the rules of

The following class contains several errors that violate the rules of Java: 1. class Thermometer \{ 2. private int temperature 3. public Thermometer(int degrees) \{ 4. temperature = degrees; 5. } 6. public Thermometer() \{ 7. temperature =0.0; 8. } 9. public void makeWarmer(int degrees) \{ 10. temperature =+ degrees; 11. } 12. public void makecooler(int degrees) \{ 13. temperature = degrees; 14. 15. public getTemperature() \{ 16. return temperature; 17. 18. public string tostring() \{ 19. return temperature + "degrees'; 20. } 21. \} Describe each error and specify whether it is (a) lexical, (b) syntactic, or (c) semantic. Use the numbers shown to identify the line on which each error occurs

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!