Welcome to Java. This is the first article of a new long tutorial series that talks about one of the richest and most popular programming languages known today: Java.
What is Java?
Java is a high-level, general-purpose, object-oriented programming language. Java was designed by James Gosling and his team in Sun Microsystems (currently owned by Oracle). Java’s first appearance to public was in 1995. Since that date, Java has gone through several cycles of improvements.
– OK, but tell me: why do I have to spend time learning Java?!
Of course I will tell you. But let’s see together the main features of Java, and you will know why Java should be your choice as the next programming language to learn and use.
Java Language Features
The following are some of the Java language features:
Easy to learn: The rules of the Java syntax were borrowed from C/C++ languages. The use of the main() function, the curly braces, the key words, the comments, the operators, and the data types all look almost the same in Java as they are in C/C++.
By this, Java inventors aimed to make Java more familiar to C/C++ users (Java came to light in a period where C, C++, and Visual C++ were dominant). If you have worked with C, C++, and/or Visual C++, learning Java will be some kind of fun for you.
Object Oriented: Using classes and objects in Java is a must as you will see. Even the simplest program that prints a hello message must define a class within which the main() function is to be defined. As you know, supporting the OOP is a good feature, as it allows developers to model real-life entities into software-programmable objects.
Java programs are executed on a Java Virtual Machine (JVM). The Java Virtual Machine acts as if it were a separate environment (software-based machine) which is specialized in running Java programs. You can think of it as an abstract layer on top of the operating system. The JVM itself is dependent on the hardware architecture and the operating system. After writing your Java program, Java compiler converts the Java code into bytecode. This bytecode is understandable to any JVM running on any operating system, on top of any hardware. This layer of abstraction makes Java both Hardware architecture-Neutral, and
Java supports multi-threading, a feature that gives us the capability to write a program that executes several operations (tasks) almost simultaneously.
Prerequisite for Developing Android Applications
Having good knowledge of Java language is a necessity if you plan to start developing for Android.
Paving the Ground
To start writing Java programs, we need to download and install the Java Development Kit JDK. This kit contains the necessary tools and libraries needed for developing Java programs. Of these tools, Java compiler is included in the JDK kit, besides to a runtime environment to allow you to test your programs.
To install JDK on your Windows machine, follow this procedure:
1. Open your Internet browser, and browse to the Oracle website to get the JDK installation package: http://www.oracle.com/technetwork/java/javase/downloads/index.html
3. Select the appropriate radio button to accept the License Agreement.
4. From the list of available kits, click jdk-8u60-windows-x64.exe (or jdk-8u60-windows-i586.exe if you are running on 32-bits Windows machine).
5. The download should start. Package size is about 186 Mega bytes.
6. When download is complete, double-click the downloaded installation file start the installation wizard.
That is for Windows. Let’s do it for Linux.
To install JDK on your Linux box, follow these steps:
3. Install the JDK package using the yum command.
yum install -y java-1.7.0-openjdk.i686 java-1.7.0-openjdk-devel.i686
That is all for Linux.
Now, our environment is ready, and so we are!!! Let’s start developing!!!
* * * * * *
In this article, we have started our journey with learning Java. Java came to light in 1995, by efforts from its inventor and his team in Sun Microsystems. Java’s syntax was borrowed from C/C++ languages. Java inventors wanted to make learning Java easier. Java is: easy to learn, platform independent, hardware architecture-neutral, object oriented, and multi-threaded. Also, learning Java is a prerequisite to developing Android applications. We have learned how to download and install the Java Development Kit (JDK) on both Windows and Linux machines. Having this achieved, we ready to start writing Java programs.
That was part one in a long series of articles to come. So, don’t miss one.
Stay here, and don’t go anywhere!!!