Question: In the following code there are around 5 errors. Find each error, write line number that contains the error and correct it in the simplest

In the following code there are around 5 errors. Find each error, write line number that contains the error and correct it in the simplest possible way 15. public class T extends B{ 16. public int z 1. Public class A{ 2. public void set(int x); 3. public int get(); 4. } 5. public class B implements A{ 6. private int x; 7. private int y; 17. public void setY(int y){ 18. this.y = y; 19. } 20. public int getY(){ 21. return this.y; 22. } 8. public void set(int x) { 9. this.x =x; 10.} 11. public int get() { 12. return this.x; 13. } 14.} 23. public String toString(){ return "("+this.get()+","+this.getY()+","+z+")"; 25. } 26. } 27. public class Main { 28. public static void main(String[] args) { 29. Tt = new T(); 30. t.setX(5); 31. t.setY(10); 32. T.z = 10; 33. System.out.println(c); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
