|
|
|
|
|
|
|
|
|
|
||||||||||
|
Java
is a third-generation programming language, like C, FORTRAN, SmallTalk,
Perl etc. It is most similar to C. If you know C or C++, you can learn
Java better; but this is never a prerequisite.
The main important property of Java is that, when you developed an application, you can use this application in your web pages. Java is creating special types of programs which are called APPLETs, that can be downloaded from the Internet and played safely with an Internet Browser. The security precautions
are well done in Java. Applets are restricted: They cannot write onto your
harddisk without your permission. It
cannot write into an arbitrary address in the memory so that they will
not be the cause of your system crash. malloc() and free() operations are
completely omitted in Java which causes a lot of -dangerous- errors in
C. In
object-oriented programs data is represented by objects. Objects have two
sections, fields (instance variables) and methods. Fields tell you what
an object is. Methods
tell you what an object does. These fields and methods are closely tied
to the object's real world characteristics and behavior. When a program
is run
Object oriented programming is alleged to have a number of advantages including:
More efficient reuse of code Faster time to market More robust, error-free code Java is safe since it allows you to write error-free (bugless) code. Memory allocation and such other error generating stuff do not exist in Java. Using a just-in-time compiler, Java is high-performance. Java is inherently multi-threaded. A single Java program can have many different threads executing independently and continuously. Three Java applets on the same page can run together with each getting equal time from the CPU with very little extra effort on the part of the programmer. This makes Java very responsive to user input. It also helps to contribute to Java's robustness and provides a mechanism whereby the Java environment can ensure that a malicious applet doesn't steal all of the host's CPU cycles. Unfortunately multithreading is so tightly integrated with Java, that it makes Java rather difficult to port to architectures like Windows 3.1 or the PowerMac that don't natively support preemptive multi-threading. There is a cost associated with multi-threading. Multi-threading is to Java what pointer arithmetic is to C, that is, a source of devilishly hard to find bugs. Nonetheless, in simple programs it's possible to leave multi-threading alone and normally be OK. The compiler produces
a .class file which contains the byte code for the program. If your program
contains more than one .java files; that is, in case you need other programs
included in your particular Java program, Java compiler finds the uncompiled
ones among them and recompiles. Compiler uses a specific environment variable
to search libraries for Java programs. This variable is CLASSPATH.
|
|
|
|
|
|
|