Trying to answer several questions at once here in the description. For installation you have many choices depending on the version of Ubuntu you are using. I will list 4 different methods here:
1. Command Terminal Method: Ubuntu 12.04 LTS (Ubuntu 12.10 Quantal Quetzal)
First, remove openjdk if it's installed. To so so type:
sudo apt-get purge openjdk*
Next type these commands:
sudo add-apt-repository ppa:eugenesan/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
2. Command Terminal Method: Ubuntu 10.04 (Lucid Lynx)
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin
sudo update-alternatives --config java
3. An easy way to do it graphically is with Ubuntu's "Synaptics" package manager tool.
First, click "Update" to refresh and update your repositories. Then search for "Java" and "Java plugin". Install the JRE for the VM, JDK if you plan on developing in Java, and the plugin for JApplet and Applet access through FireFox. Check them and click "OK" to confirm and Synaptics will install them.
4. Another easy way is to go to Sun's website and download the .bin/tar file.
First, goto http://www.oracle.com/technetwork/java/javase/downloads/index.html.
Click the "JRE" or "JDK" buttons (I install them both for development).
Choose Linux86 for 32-bit Ubuntu and Linux64 for 64-bit Ubuntu.
Download the tar.gz file for your version of Ubuntu.
Make it executable with: sudo chmod 777 FileName.tar.gz.
Decompress it with: sudo gunzip FileName.tar.gz.
De-archive it with: sudo tar -xvf FileName.tar.
Run the installation (.bin) file and chmod if necessary.
Remember to use the "./", for example: sudo ./install.bin .
I also highly recommend downloading and installing NetBeans - a great free compiler that does Java, C++, HTML, PHP and many other things. Download it and install it the same way you would install the JRE and JDK from Oracle.