You are on page 1of 7

3.

CHARACTERISTICS OF JAVA

I'm sure that you have eared a lot of things about Java™. Here you have a b
rief relaction of some of this things. Some of the characteristics that we descr
ibe here, were extracted from a White Paper where the Java™ developers exp
lains their desing goals and accomplishments. In spite of that paper is organiz
ed along eleven buzzwords, we make reference here to only six of that buzzw
ords. Here you have the relaction of them :

Simple Portable

Object Oriented Interpreted

Distributed High Performance

Robust Multithreaded

Secure Dynamic

Architecture Neutral

Search the White Paper at http://java.sun.com/docs/white/index.html

3.1.DESCRIPTION OF FEATURES

Java™ is simple

We wanted to build a system that could be programmed easily without a lot o


f esoteric training and which leveraged today's standard practice.

Java™, which is one of the most modern programming languages, is a mixtur


e of many other programming languages (C, C++, LISP, Objective-C, MESA, M
odula3...). Specially, the syntax in Java™ is very similar to C and C++, but Jav
a™ is too much simple than these languages (later we'll see the differences b
etween Java™ and C++). This simplicity, with the fact that Java™ is an strong
ly tiped language, makes Java a powerful programming language.

Java™ is robust

Java is intended for writing programs that must be reliable in a variety of way
s. Java puts a lot of emphasis on early checking for possible problems, later d
ynamic (run-time) checking, and eliminating situations that are error-prone....
The single biggest difference between Java and C/C++ is that Java has a poin
ter model that eliminates the possibility of overwriting memory and corruptin
g data.

Some of these differences, make Java™ a very robust programming language.


For example, Java don't allows multiple inheritance, it haven't pointers which
are a source of continuous mistakes and it's a strongly-tiped programming la
nguage. For these and too many others things programers from all around th
e world can say that Java™ is a very robust language.

Java™ is an Object-Oriented Programming Language

Simply stated, object-oriented design is a technique for programming that foc


uses on the data (=objects) and on the interfaces to that object. To make an
analogy with carpentry, an "object-oriented" carpenter would be mostly conc
erned with the chair he was building, and secondarily with the tools used to
make it; a "non-object-oriented" carpenter would think primarily of his tools.
The object-oriented facilities of Java are essentially those of C++.

Maybe you don't know yet how is the Object-Oriented Programming and may
be you are worried for this. Don't worry. You probably know already the struct
ured programming. If you think a bit about the model of structured programm
ing, you'll see that it's not the same model that we use naturally to organize t
he information in our sense. The OOP (Object-Oriented Programming) tries to
use in programming, the same model which our sense uses. So, you will learn
rapidly how to use this way of programming.
The OOP has only one difficulty: you have to learn some new concept based i
n a special object-oriented terminology. So, you will ear words like object, cla
ss, instance... and you will ear that OOP has based on three major properties:
encapsulation, polymorphism and inheritance. You will learn more about this
along this tutorial.

Java™ is portable (because is both compiled and interpreted)

...Unlike C and C++, there are no "implementation-dependent" aspects of the


specification. The sizes of the primitive data types are specified, as is the beh
avior of arithmetic on them...

... The Java interpreter can execute Java bytecodes directly on any machine t
o which the interpreter has been ported. Since linking is a more incremental a
nd lightweight process, the development process can be much more rapid an
d exploratory...

While most programming languages you have only to compile or interpret a p


rogram to can run it on your computer, the Java™ way to do this is very differ
ent. Java™ is both compiled and interpreted and this is the difference that all
ows that portability.

You need two steps to execute a Java™ program:

Using the compiler, you translate the source code of a program into an interp
reted language called Java bytecodes.

Using the interpreter of the Java platform, you can finally execute this progra
m.

The difference between Java™ and other languages which allows Java™ to be
portable is in that first step and in that bytecodes. The bytecodes can be inter
preted on the Java platform of a any one computer. When you find, for examp
le, a Java™ applet on a web page, you are downloading a bytecode file that t
he Java Virtual Machine (JVM), which is installed on your computer, is executi
ng.

Java™ is secure

Java is intended to be used in networked/distributed enviroments. Toward tha


t end, a lot of emphasis has been placed on security. Java enables the constr
uction of virus-free, tamper-free systems.

Here you have some points which tries to guarantee the applets security in Ja
va:

Language and compiler : All the references to memory are symbolic referenc
es (you can't know where in the memory will stay your program, it only depe
nds of the JVM and of each machine).

Bytecodes checker : On the Java Virtual Machine the bytecodes code is check
ed to confirm that it was compiled on an standard compiler.

Classes loader : Each applet is loaded on its own memory space, to make imp
ossible the information interchange between applets.

Security on applets : The programmer can configure his communications with


a certain degree of security.

Java™ is multithreaded

... (the) benefits of multithreading are better interactive responsiveness and r


eal-time behavior.

A good way to prevent your Java programs from locking up is to use multithre
ading, which simply means you write a program that enables multiple executi
on streams to occur simultaneously within the same program

Threads are rapidly becoming an important programming facility, particularly


for Internet-related applications. They permit a form of parallelism within a si
ngle program that can greatly improve program performance. For instance, t
he Netscape 3.0 browser and its posterior versions permits the user to downl
oad a file while continuing to browse the WWW, an example of multiple threa
ds within a program.

Using multiple threads in Java programs is far easier than in C or C++ becaus
e of the language-level support offered by the Java programming language.

3.2.DIFFERENCES BETWEEN JAVA AND JAVASCRIPT

Most people thinks that Java™ and JavaScript are the same thing, but they
are wronged. See here what are the differences between these two language
s:

JavaScript Java

Object-based. Code uses built-in, extensible objects, but no classes or inherit


ance. Object-oriented. Applets consist of object classes with inheritance.

Interpreted (not compiled) by client. Compiled on server before execution on


client.

Code integrated with, and embedded in, HTML. Applets distinct from HTML (a
ccesed from HTML pages).

Variable data types not declared (loose typing). Variable data types must be
declared (strong typing).

Dynamic binding. Object references checked at run-time. Static binding. Obje


ct references must exist at compile-time.

3.3.DIFFERENCES BETWEEN JAVA AND C++


...we found that C++ was unsuitable, we designed Java as closely to C++ a
s posible in order to make the system more comprehensible. Java omits many
rarely used, poorly understood, confusing features of C++ that, in our experi
ence, bring more grief than benefit...

...The object-oriented facilities of Java are essentially those of C++....

...The single biggest difference between Java and C/C++ is that Java has a poi
nter model that eliminates the possibility of overwriting memory and corrupti
ng data...

...In a number of ways, Java is a more dynamic language than C or C++. It wa


s designed to adapt to an envolving enviroment...

In a first contact, Java™ seems like C++, and it's logical because how we hav
e said Java™ takes the C and C++ syntax. Java™ have nevertheless some im
portant differences with C++. For instance, you can't use pointers in Java™, n
either operators overload, neither multiple inheritance, neither predefined typ
es. These features of C++ that Java doesn't has, make it a simplest and more
robust language. Interpreted Java™ is furthermore slowly than C++ (even 20
to 50 times slower than C in the original Java interpreters).

Main differences between Java™, C and C++

Memory administration:

Java memory administration is automatic; memory is assigned automatically


when you creat an object, and also a garbage collector frees the memory wh
en that object is no used.

Functions malloc() and free() don't exist in Java.

Tipe of data:
Primitive Java data (like char, int, long...) have sizes and behaviors which con
sist in some platforms and operative systems. In Java language, don't exist u
nsigned data.

The boolean data has two values in Java : true and false. So it isn't an integer
type, but you can force "0" and "1" (which are integers) to be booleans.

Operators:

The execution order of the operators is the same as in C. But, for example, th
e special word new (to create a new object) is linked in a more narrow form t
han point notation (.), which has another behavior in C++.

Flux Control:

The syntax of the following statements if, while, for and do is the same as in
C and C++. But there is an important difference : the proof expression for ea
ch flux construction should return a boolean value (true or false). In C and C+
+, the expression can return an integer.

Arguments:

In Java all method definitions have to have an specific number of arguments.

The arguments in the command line have a different behavior than in C and
C++. So, in this languages argv[0] is the name of the program but in Java thi
s is the first of additionals arguments.

You might also like