Monday, 9 July 2007

Java Fundamentals (part 2)

Java 1.2 Fundamentals


The Java Platform


The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other, hardware-based platforms. The Java Platform has two components:


The Java Virtual Machine (JVM)


The Java Application Program Interface (Java API)


You have already been introduced to the JVM, it’s the base for the Java Platform. The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface (GUI) widgets. Some of the important features provided by the APIs are shown below:


Security – both low-level and high-level, including electronic signatures, public/private key management and access control.


Java Database Connectivity (JDBC) - provides uniform access to a wide range of relational databases. Networking - URLs, TCP and UDP sockets, and IP addresses.


Object serialization – Allows lightweight persistence and communication via Remote Method Invocation (RMI).


Internationalization – Help for writing programs that can be localized for users worldwide. Programs can automatically adapt to specific locales and be displayed in the appropriate language.


Garbage Collection


In many programming languages, memory is allocated dynamically at runtime with the developer responsible for deallocating this memory. If the developer neglects this somewhat difficult exercise, a memory leak occurs. Eventually, the program will crash as there will be no more memory available.


This process of disposing or deallocating objects which require memory is called garbage collection. Garbage collection is automatic in Java, as Java provides a system-level thread to track memory allocation. The garbage collection process will deallocate memory in the background whilst the program is running. During idle cycles in the JVM, the garbage collection thread checks for and frees any memory that can be freed.

No comments: