How different is Java for JRE vs Java for Android?
I’m new to all this game developing, and I’m starting to learn java because I was told it was a great way to start. I want to later on create games for the android market, and want to get a good view from you guys, so I know what I’m dealing with exactly. I DO realize that Android development has different architectures and whatnot (that a good way to say it?) Thanks!
\$\begingroup\$ For what it’s worth, Android applications are typically written in Java. The difference between the two is that «Android» is an operating system and «Java» is a programming language. They serve different (non-overlapping) purposes. \$\endgroup\$
2 Answers 2
To create Android applications you use Java and the extension libraries that Android provides. These aren’t extensions in the Java Language sort of way; I mean libraries that are shipped with Android to help you achieve the common things you’d want to do on a cellphone.
For example, Blackberry (another Java-based mobile OS) uses Java as the language of choice, and Research In Motion provides a set of libraries in the RIM package that helps me abstract things that I’d commonly do on my phone.
You can use pure Java but most of the time you want to use the RIM libraries provided by RIM.
If you’re completely new to programming I would recommend first learning good Java principles — classes, methods, object-oriented programming, etc; then learning the Android API provided by Google. If you learn Android first you’ll get confused quick and not follow good programming practices.
I recommend starting with the book Head First Java.
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 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 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.