Int: By default, the int data type is a 32-bit signed two's complement integer, which has a minimum value of -231 and a maximum value of 231-1. It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive). Short: The short data type is a 16-bit signed two's complement integer. It has a minimum value of -128 and a maximum value of 127 (inclusive). The eight primitive data types supported by the Java programming language are:īyte : The byte data type is an 8-bit signed two's complement integer. Catch block must be used after the try block. Catch block is used to handle the exception by declaring the type of exception with the parameter. Try block is used to enclose the code that throws an exception. There are two blocks to handle an exception: try and catch block. Exception handler chosen is said to catch the exception. Search begins with the method in which the error occurred and proceeds through the list of methods in reverse order. Run time system searches the list of methods that can handle the exception. This process is known as throwing an exception.Īfter this, the run time system finds something to handle it. When an error occurs within a method, the method creates an object known as an exception object which contains information about the error. Example: if the program tries to open a file that does not exist, divide by zero, etc. In computer programming, an exception is a special condition encountered during program execution or run time.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |