This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes indexOf() of String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "indexOf() of String" Watch "indexOf() of String" New topic

indexOf() of String

mi te

Joined: Mar 09, 2006
Posts: 29
why the method of String, int indexOf(int ch), takes in an argument of type int? Why not the type char?
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24183

My guess: a historical mistake. Similar routines in the C language standard library take int arguments.

[Jess in Action][AskingGoodQuestions]
subject: indexOf() of String