Input and Output Streams in Java

A stream is a water body that carries water as it flows from one point to another. In programming terminology , a stream can be a continuous group of data or a channel through which data travels from one point to another. An input stream receives data from a source into a program and an output stream sends data to a destination from the program.

User Defined Exception in Java

The built-in exceptions provided by the Java platform are used to handle errors occurring in the program. But , sometimes the programmer wants to create his own application specific exceptions. User defined exception can be created simply by defining a subclass of Exception class and using the throw keyword.

Recursion in Java

Java support Recursion function. Recursion is the attribute that allows a method to callitself. A method that calls itself is said to be recusive. The best example of recursion is the computation of the factorial(1*2*3*4*5) of a number. The factorial of a number n(any last number) is the product(*) of all the whole numbers between 1 and n.

Scope and Lifetime of Variables in Java

So far, all of the variables used have been declared at the start of the main(). However, Java allows variables to be declared within any block. A block is begun with an opening braces and ended by a closing braces. A block defines a scope.

The Finally block in Java

Finally blocks are executed once the try block exits. This block executes even after the unexpected exceptions has occurred. Irrespective of the try block, the expression in finally block is always executed. This block is in-built with the capability of recovering loss and preventing leak of resources. On closing and recovery of a file, the expression should be placed in the finally block.

Page 3 of 20