Q. In Java, can a method declare "throws" for a checked exception that is not thrown in the method body?

  • (A) Only if the exceptions are marked as "final"
  • (B) Only if the method is marked as "static"
  • (C) Yes, a method can declare "throws" for checked exceptions that are not thrown in the method body
  • (D) No, a method must throw all the exceptions it declares
πŸ’¬ Discuss
βœ… Correct Answer: (C) Yes, a method can declare "throws" for checked exceptions that are not thrown in the method body

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
154
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Vinay
Publisher
πŸ“ˆ
90%
Success Rate