Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

K&B page 568 minor bugs

 
Marius Paraschiv
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the table 7-4 there are listed some methods from java.util.Arrays and java.util.Collections, and some of them have the access modifier and some of them not. All the methods should be marked as public.
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to check the errata. I am not sure if this is listed there but it would sure be of help to you.

I cant remember the link though Search this forum and you will find people who have provided the errata link
 
Bhushan Chhajed
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I went through the javadoc 6.
All the methods including those which are not declared as public are actually, public!
The asList, binarySearch or equals in Arrays are all public.
Similar is the case with methods of Collections class.
 
Marius Paraschiv
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@John Meyers

Before I have posted this, I have looked at this errata and this is not on the list. Is there any new errata list ?

@Bhushan Chhajed

Arrays and Collections are utility classes and they must mark their api methods as public to be accessible by any class. Don't mistake utility classes with interfaces, where you don't have to type public abstract in front of the methods. I have looked even in the source code of the JDK(I'm using 1.5.0_15) and of course the methods are marked public.


Another little typo is on the page 610:

The generics type identifier can be used in class, method, and variable declarations:
class Foo<t> { } // a class
T anInstance; // an instance variable
Foo(T aRef) {} // a constructor argument
void bar(T aRef) {} // a method argument
T baz() {} // a return type
The compiler will substitute the actual type.

"t" must be "T"

[ July 06, 2008: Message edited by: Marte Marte ]

[ July 06, 2008: Message edited by: Marte Marte ]
[ July 06, 2008: Message edited by: Marte Marte ]
 
Bhushan Chhajed
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marte Marte:
[QB@Bhushan Chhajed

Arrays and Collections are utility classes and they must mark their api methods as public to be accessible by any class. [/QB]

Have I said something else?
 
Marius Paraschiv
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I have misunderstood your first response, my fault.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic