Mar 05

8 Differences between Arraylist and Linkedlist in java

Differences between Arraylist and linkedlist in java?

ArrayList :

  • An arraylist is an object that can store other objects including enums.
  • An arraylist is internally implemented using array data structure.
  • Arraylist is in java.util package.
  • Arraylist can store only objects.
  • Index is used to access objects inside arraylist
  • Arraylist is dynamically resized once the list is full.
  • When an arraylist is created it is created with default capacity 10. Continue reading
Mar 03

Difference between checked exceptions and unchecked exception in java?

SNO Checked Exception Unchecked Exception
1. All the subclasses of Throwable class except error,Runtime Exception and its subclasses are checked exceptions All subclasses of RuntimeException are called unchecked exceptions. These are unchecked exceptions because compiler does not checks if a method handles or throws exceptions.
2. Checked exception should be thrown with keyword throws or should be provided try catch block, else the program would not compile. Program compiles even if we do not catch the exception or throws the exception.
3. Checked exceptions are known as compile time exceptions Unchecked exceptions are known as run time exceptions.
4. Checked exceptions are propagated by using throws keyword. Unchecked exceptions are propagated automatically in java
5. With checked exceptions we get compile time error at compile time.Program does not terminates. Program terminates when unchecked exceptions are thrown.
6. SQL Exception




EOF Exception

Interrupted Exception

Arithmetic Exception



StringIndexOutOf BoundException