Java refers to a number of computer software products and specifications from Sun Microsystems that together provide a system for developing application software and deploying it in a cross-platform environment. Java is used in a wide variety of computing platforms from embedded devices and mobile phones on the low end, to enterprise servers and supercomputers on the high end. Java is nearly ubiquitous in mobile phones, Web servers and enterprise applications, and while less common on desktop computers, Java applets are often used to provide improved functionality while browsing the World Wide Web.
Important Note:- After completing java6 installation you need to remove newly added source list otherwise it will install all the packages from unstable
First you need to edit /etc/apt/sources.list file add the following line
deb http://ftp.debian.org/debian unstable non-free
save and exit the file
Now update the source list using the following command
If you install any previous versions of sun java please remove before proceeding next step
#apt-get install sun-java6-jre