Show comments for this question (0) Add comments Link to this question
1. class Book { 2. public String title; 3. 4. public void setTitle(String title) { 5. if (checkTitle(title)) this.title = title; 6. } 7. public String getTitle() { 8. return title; 9. } 10. private boolean checkTitle(String newTitle) { 11. // code that verifies proposed title change 12. } 13. }
1. public class Boat{ 2. // insert code here 3. public void setGas(int v){ 4. gas = v; 5. } 6. }
1. // insert code here 2. void play(); 3. void stop(); 4. } 5. // insert code here 6. public void play() { } 7. public void stop() { } 8. }
11. class A { 12. public void methodX(int i) { /* some code */ } 13. public String methodY(String s) { /* some code */ } 14. } 15. class B extends A { 16. public void methodX(int i) { /* some code */ } 17. public String methodX(String s) { /* some code */ } 18. public String methodY(String s) { /* some code */ } 19. }
11. interface A { 12. void someMethod(); 13. } 14. class B implements A { 15. public void someMethod() { } 16. }