Difference Between Android and Java

Java is one of the most popular object oriented programming languages in the world. Java is heavily used for software and web development. Recently, Java has become a popular language for mobile-based applications as well. Android is a mobile phone based platform developed by Google. Android development is most of the times java-based. Large portion of Java libraries are available in Android platform, but there are many other (non-java) libraries existing in Android (for user interfaces, etc.) as well.

Java

Java is one of the most widely used object oriented (and class-based) programming languages used for software development to web development, today. It is a general purpose and concurrent programming language. It was originally developed by Sun Microsystems in 1995. James Gosling is the father of the Java programming language. Oracle Corporation now owns Java (after buying Sun Microsystems recently). Java Standard Edition 6 is its current stable release. Java is a strongly typed language that supports a range of platforms from Windows to UNIX. Java is licensed under GNU General Public License. Java’s syntax is very much similar to C and C++. Java source files have the .java extension. After compiling Java source files using the javac compiler, it will produce .class files (containing the Java bytecode). These bytecode files can be interpreted using the JVM (Java Virtual Machine). Since the JVM can be run on any platform, Java is said to be multi-platform (cross-platform) and highly portable. Typically, end users use the JRE (Java runtime Environment) to run the Java bytecode (or Java Applets on web browsers). Software developers use the Java Development Kit (JDK) for application development. This is a superset of JRE, which includes a compiler and a debugger. A nice feature of Java is its automatic garbage collection, where objects that are no longer required are removed from memory automatically.

Android

Android is a mobile phone platform developed by Google. A large portion of Java 5.0 libraries is supported in Android. Therefore, it can be said that Android development is java-based. Many of the Java libraries that are not supported either have better replacements (other similar libraries) or are simply not needed (such as libraries for printing, etc.). Libraries like java.awt and java.swing are not supported because Android has other libraries for user interfaces. Android SDK supports other third party libraries like org.blues (Bluetooth support). Ultimately, Android code is compiled in to Dalvik opcodes. Davilk is a special virtual machine optimized for mobile devices with limited resources such as power, CPU and memory.

What is the difference between Android and Java?

Java is a programming language, while Android is a mobile phone platform. Android development is java-based (most of the times), because a large portion of Java libraries is supported in Android. However, there are key differences. Unlike Java, Android applications do not have a main function. They have onCrete, onResume, onPause and onDestroy functions that should be overwritten by the developers. Java code compiles to Java bytecode, while Android code compiles in to Davilk opcode.