added exceptions to java programming