What is the difference between runtime exception and compile time exception?

Member

zella

by zella , in category: Technology , a month ago

What is the difference between runtime exception and compile time exception?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by irwin , a month ago

An exception that occurs at compile time is called a checked exception. This exception cannot be ignored and must be handled carefully. For example, in Java if you use FileReader class to read data from the file and the file specified in class constructor does not exist, then a FileNotFoundException occurs and you will have to manage that exception. For the purpose, you will have to write the code in a try-catch block and handle the exception. On the other hand, an exception that occurs at runtime is called unchecked-exception Note: Checked exception is not handled so it becomes an unchecked exception. This exception occurs at the time of execution.