Skip to main content

Posts

Showing posts from August, 2015

Exception Handling:

Exception Handling: An exception/error is an abnormal condition that breaks/disrupts the normal program flow. The abnormal condition occurs at run-time i.e. during code execution. For example, a C program gets terminated when division by zero is encountered at the run-time as this is not a defined operation and result in run-time error. The other familiar example in case of C-language is that of null pointer exception, which occurs when we try to access a memory location through an un-initialized pointer. The program gets terminated in this case also. Java has a separate construct for exception/error handling like C++. It is possible to recover from an exception/error at run-time and continue the program exception using the exception-handling construct. A java exception/error is an object of class Exception/Error or one of its sub-class. JVM creates an object of class Exception/Error or one o          f their sub-class whenever e...

PROGRAM- Matrices addition:

                                                                        Matrices addition: import java.util.*; class autoarray {             public static void main(String a[])             {                         int mat1[][],mat2[][],mat3[][];                         int rows,cols;                         Scanner sc=new Scanner(System.in); ...

Multi- Dimensional Array:

Multi- Dimensional Array:                         Declaration:                         Type vari_name[][]; The type specifies the base type of array element as in the case of one-dimensional array. For example:             The following array used to store integers element:                         in tab[][]; or int[][]ab; or                         int twod[ ] [ ] = new int [4] [5]; This allocates a 4 by 5 array and assign it to twod. Internally this matrix i...