Skip to main content


Showing posts from October, 2014

Byte Stream Vs Character Stream in Java

While doing I/O operations in Java , you may come across word like streams or bytes or characters or encoding. Don't be confuse with this word because they are all point to conman cause that is Data transfer form memory to disk or vice-versa.

When we talk about system/programing language, they are always talks in bits (binary data). When we group 8 bits we get bytes and when we group 16 bits we get the characters.

Before arrival of multiple language that is before internationalization, we have only ASCII Charset.Till that time, all was fine. Everything could be done by Byte Streams because every character was represented by one byte.

After internationalization , we have Unicode charset. In that character may be represented by two or mote bytes. It is not enough to represent character by reading one byte at a time. Hence we have to introduce Character stream to support unicode. It reads character y character.

If you are working with raw/binary data such as images, music files , th…

Java Exception Simplified

After scolding multiple time about not to do things, man commits mistakes. To handle that consequences we have Exception Handling. There are such mistakes whose consequences can be handle and there are other whose consequences can not be handle. They are totally depends upon gods fate.
 In technical term , exception that are checked at compile time are Checked Exceptions
and others are Unchecked Exceptions.This two types are present in Java but not in C++ (other OOP Language). In C++ , all exceptions are unchecked and compile does not force to handled them.

In Java they are categorized as follows

Point to consider is that Error are related to hardware failure and ultimately you can not control them from software.
There are many well-know exceptions are present and they are all categorized among Exception, RuntimeException and Error.

Why all exceptions extends Throwable?
            It has very simple and one word explanation that Java supports only Single Inheritance.

Why we need exc…