Lesson 1


- What is Java?

Java is a programming language expressly designed for use in the distributed environment of the Internet. It can be used to create complete applications that may run on a single computer or be distributed among servers and clients in a network. It can also build small applications (applets) which the user can interact. This functionality allows developers a powerful platform to distribute applications.

- Features

Simple, Object-Oriented, Distributed, Interpreted, Robust, Secure, Architecture-Neutral, Portable, High-Performance, Multithreaded, and Dynamic.

Java is simple because it consists of only of three primitive data types: numbers, Booleans, and arrays. Everything else is a class, such as strings are objects, not simply arrays of characters.

Java classes are comprised of methods and varibles. Methods are functions that an object of a class can respond to. Variables are the data. Both methods and varibles are either private, protected or public. Private means they are not accessible outside the class. Protected are accessible to sub-classes of the class, but not to others. Public are accessible to any class.

Uses a collection of classes for use in network applications. Also, classes are available to establish socket-level connections.
- No intermodule dependancies, hence there is no need for a complicated make file.
- Without the need for link (as needed in C++), Java allows for faster and easier prototyping and debugging.
- Because it is CPU independant, no need to make a new compiler for every new chip design.
- A Java virtual machine must reside on the computer running the Java application.
- It's slower in execution than a compiled & linked program. This is one reason Java applications tend to be for a few specific purposes.

Because Java runs a several operating systems and processors, its a strongly typed language. Implicit data casting is not allowed. Java not does handle direct pointer manipulation or arithmetic. Thus, memory is not overwritten, and data is not corrupted. Java provides automatic support for freeing memory that has been allocated but is no longer used.

Java applications are used on the internet. For this reason, Java was developed to avoid hostile situations from hackers and other potential data privacy issues. A byte-code verifier examines all code and ensures it plays by the rules.

Without the tedious need for complex API between operating systems, Java obtains neutrality by using a Java interpreter for each architecture (combination of processor and operating system)

All primative data types are pre-defined. That is, they are machine independant.

Java cannot maintain the speed or performance of a fully compiled language like C or C++.

Java allows the user of the application to do more than one thing at a time. An example is allowing the user to interface with the GUI, while the application communicates with a server.

Java can extend itself by linking to classes that are located on another computer. It resolves name resolution at runtime, which makes the problem of changing the definition of a class by another class less time comsuming than C++.

- Where to start
Because Java was developed by Sun Microsystems, they have an excellent site
for Java and related resources. Check out Sun Microsystem's Java Website to obtain
the JDK (Java Development Kit), which supports Java application & applet development. The site
is an excellent source of examples.

A Simple Example

Assignment 1

- Write an alternative version of the above program, not using the paint method

Return to the Top