11 Exception Handling

11.1 INTRODUCTION

In Java, errors can be divided into two categories: compile time errors and runtime errors. Compile time errors are syntactic errors during writing of the program. Most common examples of compile time errors are missing semicolon, comma, double quotes, etc. They occur mainly due to poor understanding of language or lack of concentration in writing the program.

Logical errors occur mainly due to improper understanding of the program logic by the programmer. Logical errors cause the unexpected or unwanted output.

Exceptions are runtime errors which a programmer usually does not expect. They occur accidentally, which may result in abnormal termination of the program. Java provides exception handling mechanism, ...

Get Java Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.