Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Table 7-7, page 594

 
Kitty Liem
Greenhorn
Posts: 2
Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The add(index, element) method for List returns nothing but table tells me boolean...
 
Chan Ag
Rancher
Posts: 1089
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

This tells me the return type of the method is void. Where does it say the method is supposed to return a boolean?

Which book/source has the table/code in question?

Consider reading QuoteYourSources.

Chan.
 
Siddharth Raja
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you are referring to K & B

yes, boolean add(index, element) is a mistake

its void add(index, element) ...this versio of add method is defined in the List interface only
my source (Herbert Schildt - the complete reference for Java 7th Edition)
 
Kitty Liem
Greenhorn
Posts: 2
Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, should be in Compiling errata K&B topic...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic