An Introduction to Java
Java is a simple and yet powerful object oriented programming language and it is in many respects similar to C++. Java originated at Sun Microsystems, Inc. in 1991. It was conceived by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike Sheridan at Sun Microsystems, Inc. It was developed to provide a platform-independent programming language.
One obvious advantage is a runtime environment that provides platform independence: you can use the same code on Windows, Solaris, Linux, Macintosh, and so on. This is certainly necessary when programs are downloaded over the Internet to run on a variety of platforms.
Another programming advantage is that Java has a syntax similar to that of C++, making it
easy for C and C++ programmers to learn. Then again, Visual Basic programmers will
probably find the syntax annoying.
Java is also fully object oriented—even more so than C++. Everything in Java, except for a
few basic types like numbers, is an object. (Object-oriented programming has replaced earlier structured techniques because it has many advantages for dealing with sophisticated projects.
However, having yet another, somewhat improved, dialect of C++ would not be enough. The key point is this: It is far easier to turn out bug-free code using Java than using C++. The designers of Java thought hard about what makes C++ code so buggy. They added features to Java that eliminate the possibility of creating code with the most common kinds of bugs.
• The Java designers eliminated manual memory allocation and deallocation.
Memory in Java is automatically garbage collected. You never have to worry about
• They introduced true arrays and eliminated pointer arithmetic.
You never have to worry about overwriting an area of memory because of an off-byone
error when working with a pointer.
• They eliminated the possibility of confusing an assignment with a test for equality in a
• They eliminated multiple inheritance, replacing it with a new notion of interface that
they derived from Objective C.
Interfaces give you most of what you want from multiple inheritance, without the complexity that comes with managing multiple inheritance hierarchies.