Modified the String method signatures and added exceptions