News

More About Java

0

Java is a relatively modern programming language – well, at least compared to traditional languages such as C, Pascal, and BASIC.  Java was developed by James Gosling at Sun Microsystems.  It was released in 1995.

Java is a “high level” programming language.  In this context, high level means the opposite of what you might think.  A high-level programming language is one that is fairly close to the English language, making it fairly easy for humans to read.   The term “high” refers to the amount of abstraction required to get from the code written in the programming language (in this case, Java) to the machine language that tells the computer what to do.  Using “low-level” programming language often offers performance benefits (if the code is well written), but produces code that is harder for humans to read.

Java is a particularly interesting programing language because it is portable, object oriented, and fairly easy to learn.  It takes a lot of its syntax from C and C++, which are incredibly popular and well-known languages.  The difference between Java and the C family is that Java offers fewer low-level functions.

When a java developer writes an application, they compile it into bytecode, and this bytecode can run on any Java Virtual Machine, no matter what operating system the computer is running, or what type of processor the computer has.  Java is designed to let developers “Write Once, Run Anywhere”.  This means it is the language of choice for open source application developers that want to ensure their programs are accessible to as many people as possible.

Java Performance
When Java was first released, it was far slower and far less efficient than more platform specific languages.  Over time, Java’s performance has improved massively, but benchmarks still show a small difference in performance between Java and C. A growing number of hardware manufacturers are offering native support for Java, and performance on those platforms is generally good.

Java Syntax
Java and C++ have many similarities in terms of syntax, but there are some differences too. Java is designed as a purely object-oriented language.  All Java code is written inside a class, and everything (except for primitive data types such as character, integer, Boolean, and floating point numbers) is a class.

This completely object-oriented approach is something that confuses many people when they try to make the move from C/C++ to Java developer. C++ is an object oriented language, but because it was derived from C it still retains support for generic and structured programming.

A simple program in Java, to print the phrase “Hello World” on the screen, would look like this:

class GreetingApp {

                public static void main(String[] args)

{

                /**

The text contained between the opening /** and the closing “star and slash” is considered to be a comment, which means that it will be ignored by the compiler.  This text is only for humans to read.

*/

                System.out.println(“Hello World”)

}

}

The above may seem like a lot of code to print some text on the screen, especially to those familiar with BASIC on older computers, where you could achieve the same goal with the following:

10 Print “Hello World”

However, for more complex programs, the setting up of classes and methods is important.

Java is a good first programming language to learn today.  It is a popular language for browser based applications, and is also used on many mobile phones.

Attached Images:
  •  License: Creative Commons image source

This article was written by Crispin Jones on behalf of dsp, a java developer. Find out more about this java developer on their site.

Photo: AGmakonts

Top iPhone Apps For Students

Previous article

Save Time Finding A VPS-Hosting Service With These Top Tips

Next article

You may also like

Comments

Comments are closed.

More in News