Furthermore, any method that attempts to access an index that is beyond the range of this array throws IndexOutOfBoundsException.
so basically all String methods throw IndexOutOfBoundsException except substring() which throws StringIndexOutOfBoundsException ?
[HD-OCP17/21-Fundamentals Pg 265, Sec. 11.1.6 - manipulating-strings]
Moderator: admin
-
- Posts: 167
- Joined: Sun Apr 21, 2024 10:43 am
- Contact:
-
- Site Admin
- Posts: 10383
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: [HD-OCP17/21-Fundamentals Pg 265, Sec. 11.1.6 - manipulating-strings]
For most of the methods (that throw IOOBE) of the String class, the JavaDoc say these methods throws IOOBE but the implementation of some of these methods (including substring) throw SIOOBE. Since SIOOBE extends IOOBE, the implementation is technically within the agreed contract.
The JavaDoc for indexOf method says it throws SIOOBE.
The JavaDoc for indexOf method says it throws SIOOBE.
Who is online
Users browsing this forum: Bing [Bot] and 18 guests