wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Exception

Vrushank Shukla
Greenhorn

Joined: Sep 10, 2012
Posts: 14


Now, if the String length is 0, then reverse() method will throw an exception. But i didn't get any exception, the program compile and run fine. Why??
Shahir Deo
Ranch Hand

Joined: Mar 19, 2013
Posts: 69

Why and Which Exception You Expect to be Thrown?


Knowledge enlivens the soul.
Vrushank Shukla
Greenhorn

Joined: Sep 10, 2012
Posts: 14
I think it would be StringIndexOutOfBound.
Shahir Deo
Ranch Hand

Joined: Mar 19, 2013
Posts: 69



java.lang.StringIndexOutOfBoundsException
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Locking as duplicate of http://www.coderanch.com/t/608535/java/java/Exception
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception
 
Similar Threads
how to do this? (exception) can u help me to fix?
Exercise 5-3: Propagating and Catching an Exception
Propogating Exceptions - Exercise5.3 in K&B
Why do i get this run time eroor... plz help
Propagating and Catching an exception problem