6.13.Questions |
| 6.13.1. | Is it legal enums: enum Animals {int age;LION, TIGER, DOG;} | | |
| 6.13.2. | Answer: enum and underline value | | |
| 6.13.3. | Is it legal enums:enum Animals {LION, TIGER, DOG;int weight;} | | |
| 6.13.4. | Answer: enum definition in a class | | |
| 6.13.5. | Is it legal enums? | | |
| 6.13.6. | Answer: enum, underline value and constructor | | |
| 6.13.7. | Is it legal enums(enum and constructor)? | | |
| 6.13.8. | Answer: enum and constructor | | |
| 6.13.9. | Which of the following may override a method whose signature is void a(float f)? | | |
| 6.13.10. | Answer: method signature and override | | |
| 6.13.11. | An enum definition should declare that it extends java.lang.Enum(True/False). | | |
| 6.13.12. | Answer: enum definition and java.lang.Enum | | |
| 6.13.13. | An enum may be subclassed(True/False). | | |
| 6.13.14. | Answer: enum and subclassing | | |
| 6.13.15. | An enum may contain public method definitions(True/False). | | |
| 6.13.16. | Answer: enum and methods | | |
| 6.13.17. | An enum may contain private data. | | |
| 6.13.18. | Answer: enum and data | | |
| 6.13.19. | An enum definition may contain the main() method of an application(True/False). | | |
| 6.13.20. | Answer: enum and main method | | |
| 6.13.21. | You can call an enum's toString() method(True/False). | | |
| 6.13.22. | Answer: enum and toString() method | | |
| 6.13.23. | You can call an enum's wait() method(True/False). | | |
| 6.13.24. | Answer: enum and wait method | | |
| 6.13.25. | You can call an enum's notify() method(True/False). | | |
| 6.13.26. | Answer: enum and notify method | | |
| 6.13.27. | Which are incorrect class declarations? | | |
| 6.13.28. | Answer: class declaration | | |
| 6.13.29. | What is the output from the following code | | |
| 6.13.30. | Answer: final variable | | |
| 6.13.31. | What is wrong with the following code? | | |
| 6.13.32. | Answer: local variable | | |
| 6.13.33. | Which of the following constructor signatures must exist in the Demo class for DerivedDemo to compile correctly? | | |
| 6.13.34. | Answer: constructor and class hierarchy | | |
| 6.13.35. | Which is a correct class based on the following interface? | | |
| 6.13.36. | Answer: class and interface implementation | | |
| 6.13.37. | What is the result when trying to compile and run the following code(class definition hierarchy)? | | |
| 6.13.38. | Answer: class definition hierarchy | | |
| 6.13.39. | What is the result when trying to compile and run the following code(final and class hierarchy)? | | |
| 6.13.40. | Answer: final and class hierarchy | | |
| 6.13.41. | Cohesion is to hide implementation details(True/False) | | |
| 6.13.42. | Answer: cohesion | | |
| 6.13.43. | Cohesion is to make sure that classes know about other classes only through their APIs(True/False) | | |
| 6.13.44. | Answer: cohesion(2) | | |
| 6.13.45. | Cohesion is to make sure that a class is designed with a single, well-focused purpose(True/False) | | |
| 6.13.46. | Answer: cohesion(3) | | |
| 6.13.47. | Cohesion is to allow a single object to be seen as having many types(True/False) | | |
| 6.13.48. | Answer: cohesion(4) | | |
| 6.13.49. | Will the following code compile(class hierarchy)? | | |
| 6.13.50. | Answer: class hierarchy | | |
| 6.13.51. | What is the result when trying to compile and run the following code(class hierarchy and override)? | | |
| 6.13.52. | Answer: class hierarchy and override | | |
| 6.13.53. | What is the result(method overload)? | | |
| 6.13.54. | Answer: method overload | | |
| 6.13.55. | What is the result(polymorphism and static method)? | | |
| 6.13.56. | Answer: polymorphism and static method | | |
| 6.13.57. | What is the result(three level class hierarchy)? | | |
| 6.13.58. | Answer: three level class hierarchy | | |
| 6.13.59. | What is the result(constructors and superclass)? | | |
| 6.13.60. | Answer: constructors and superclass | | |
| 6.13.61. | What is the result(Polymorphism and instance methods)? | | |
| 6.13.62. | Answer: Polymorphism and instance methods | | |
| 6.13.63. | What is the result(overloaded and var-args methods)? | | |
| 6.13.64. | Answer: overloaded and var-args methods | | |