This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confusion about method signature (Java OCA 8 Programmer I Study Guide, Sybex)

 
Aleksandra Pestova
Ranch Hand
Posts: 36
2
Firefox Browser Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the study guide in Chapter 3 in the section "Important String methods" method signatures include the return type, e.g.
The method signature is as follows:
char charAt(int index)


I did a small Google research and found out that method signature includes only:
1. method name
2. parameter types and names

I also checked the errata of the book here and did't find any method signature errors.

So how is it with the method signature? Is it an error in the book?
Then in the above example method signature would be: charAt(int index) ?

Thanks in advance!
 
Aleksandra Pestova
Ranch Hand
Posts: 36
2
Firefox Browser Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, suddenly found a thread with the same question. 
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aleksandra Pestova wrote:So how is it with the method signature? Is it an error in the book?
Then in the above example method signature would be: charAt(int index) ?

According to the Defining Methods section (of Oracle's Learning the Java Language tutorial), the method signature contains two of the components of a method declaration: the method's name and the parameter types. So for the method declaration public char charAt(int index), the method signature is charAt(int). And thus for 100% accuracy, the term "method signature" should be replaced with "method declaration" in the study guide (but both terms are often used interchangeably).

Hope it helps!
Kind regards,
Roel
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aleksandra Pestova wrote:Sorry, suddenly found a thread with the same question. 

It is always nice to share the thread you have found, so other ranchers can benefit from your question and your search capabilities
 
Ganish Patil
Ranch Hand
Posts: 529
19
Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Netbeans IDE Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And only method's name and the parameter types ( Method signature )are considered in method overriding.
 
Aleksandra Pestova
Ranch Hand
Posts: 36
2
Firefox Browser Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!

Now it's clear about method signature and declaration.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic