Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Java Class 2

Recap

  • Packages
  • Reading Java documentation
  • Using an example of documentation (Date)
  • Handling Exceptions

New stuff:

  • unchecked and checked exceptions
  • throw and throws
  • the try-catch statement; finally, try-with-resources
  • Use static methods of java.util.Arrays and java.lang.Integer.
  • Implement a dynamically resizing ArrayList class storing int values in an array; operations are: get(i), set(i,n), add(n), insert(i,n), remove(i).

Throw example:

void myMethod() {
  //Throwing single exception using throw
  throw new ArithmeticException("An integer should not be divided by zero!!");
}

Documentation

Finally block

Try with resources

Exercise:

Handle the exceptions on the last class Exercise.