• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exceptions in method signature

 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does method 'signature' includes or excludes exceptions?
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the JLS

8.4.2 Method Signature

The signature of a method consists of the name of the method and the number and types of formal parameters to the method. A class may not declare two methods with the same signature, or a compile-time error occurs.

 
Matthew Brown
Bartender
Posts: 4568
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the signature included exceptions, you'd be able to do this without a compiler error because the two methods would have different signatures:
 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks John and Mathew!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic