Oracle Java 7 and Apple Java 6 are completely different and they coexist on the same machine as they inhabit totally separate locations.
Java 7, if installed, lives in:
/Library/"Internet Plug-Ins"/JavaAppletPlugin.plugin/Contents/Home
Java 6, if installed, lives in:
/System/Library/Frameworks/JavaVM.framework/Versions/A/
(And the more traditional Java 6 JDK is at: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home)
When you type java, you're running /usr/bin/java, which is a symbolic link to Java 6. In fact, if you type ls -l /usr/bin | grep -i java you will see a bunch of symbolic links for the typical JDK/JRE executables.
So if you have installed Java 7, and that's what you want to use from the command line, you can change into its directory and run its specific binaries in bin. To avoid that, you can add its bin directory to your Bash search path, so its contents are invoked instead of the Java 6 symlinks in /usr/bin. To do this, alter /etc/paths to add the bin directory before the first line:
{ echo "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin"; \
cat /etc/paths; } | sudo tee /etc/paths > /dev/null
Then set the JAVA_HOME environment variable, so supporting software knows where to find Java 7:
{ echo -n "export JAVA_HOME=";
echo "/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"; } \
| sudo tee -a /etc/bashrc > /dev/null
Now, in any new Terminal window, when you type java -version, you'll see java version "1.7.0_51". (And if you still want to be able to run the Java 6 binaries, you can call them with /usr/bin/java, /usr/bin/javac, etc.)