The question arises that why java was chosen for Android Application Development instead of something like C, C++ etc.
Google provides a Java API to get started and compiles your files into classes. Why did Android prefer Java for its development platform? There are multiple reasons such as; Java is a commonly used language and many programmers know it, it can run on a virtual machine (VM) so no need to recompile for different phones, better security, many development tools available for Java, and Java is a known industry language with most phones compatible with it.
Though Google provides the Java API, Android does not use JVM to execute class files. Rather, it uses Dalvik Virtual Machine (DVM). The class files are compiled into Dalvik Executable (DEX) format, and bundled as Android Package (APK) along with other resources.
With Java, if you are aware of object-oriented programming principles, creating applications for android will be much simpler than iOS app development.
There are some major benefits of using java
- Easy to Learn: Many would be surprised to see this one of the top reason of learning Java, or considering it as best programming language, but it is. If you have steep learning curve, it would be difficult to get productive in short span of time, which is the case with most of professional project. Java has fluent English like syntax with minimum magic characters e.g. Generics angle brackets, which makes it easy to read Java program and learn quickly. Once a programmer is familiar with initial hurdles with installing JDK and setting up PATH and understand How Classpath works, it’s pretty easy to write program in Java.
- Object Oriented Programming Language: Another reason, which made Java popular is that it’s an Object Oriented Programming language. Developing OOPS application is much easier, and it also helps to keep system modular, flexible and extensible. Once you have knowledge of key OOPS concept like Abstraction, Encapsulation, Polymorphism and Inheritance, you can use all those with Java. Java itself embodies many best practices and design pattern in it’s library. Java is one of the few close to 100% OOPS programming language. Java also promotes use of SOLID and Object oriented design principles in form of open source projects like Spring, which make sure your object dependency is managed well by using dependency Injection principle.
- Java has Rich API: One more reason of Java programming language’s huge success is it’s Rich API and most importantly it’s highly visible, because come with Java installation. When I first started Java programming, I used to code Applets and those days Applets provides great animation capability, which amazes new programmer like us, who are used to code in Turbo C++ editor. Java provides API for I/O, networking, utilities, xml parsing, database connection, and almost everything. Whatever left is covered by open source libraries like Apache Commons, Google Guava and others.
- Powerful Development Tools: Believe it or not, Eclipse and Netbeans has played huge role to make Java one of the best programming language. Coding in IDE is pleasure, especially if you have coded in DOS Editor or Notepad. They not only helps in code completion but also provides powerful debugging capability, which is essential for real world development. Integrated Development Environment (IDE) made Java development much easier, faster and fluent. It’s easy to search, refactor and read code using IDEs. Apart from IDE, Java platform also has several other tools e.g.. Maven and ANT for building Java applications, decompilers, JConsole, Visual VM for monitoring Heap usage etc.
- Java is Platform Independent: In 1990s, this was the main reason of Java’s popularity. Idea of platform independence is great, and Java’s tag line “write once run anywhere” was enticing enough to attract lots of new development in Java. This is still one of the reason of Java being best programming language, most of Java applications are developed in Windows environment and run in UNIX platform.
- Java is Everywhere: Yes, Java is everywhere, it’s on desktop, it’s on mobile, it’s on card, almost everywhere and so is Java programmers. I think Java programmer out number any other programming language professional. Though I don’t have any data to back this up, but it’s based on experience. This huge availability of Java programmers, is another reason, why organization prefer to choose Java for new development than any other programming language.
- Java is FREE: People like FREE things, Don’t you? So if a programmer want to learn a programming language, or a organization wants to use a technology, COST is an important factor. Since Java is free from start, i.e. you don’t need to pay anything to create Java application. This FREE thing also helped Java to become popular among individual programmers, and among large organizations. Availability of Java programmers is another big think, which makes organization to choose Java for there strategic development.
- Java is a known language, developers know it and don’t have to learn it
- it’s harder to shoot yourself with Java than with C/C++ code since it has no pointer arithmetic
- it runs in a VM, so no need to recompile it for every phone out there and easy to secure
- large number of development tools for Java
- several mobile phones already used Java ME, so Java was known in the industry
- the speed difference is not an issue for most applications; if it was you should code in low-level language