Friday, September 20, 2024

Where can I use Java?

Java can be used to create web pages with dynamic and interactive content, to create applications (programs) with Graphical User interfaces (GUIs) and applications that use graphics, animation, audio, and video. With Java, you can also write applications for wireless devices like cell phones and personal digital assistants. In fact, wireless devices can communicate with each other by using Java technology!

Portability
Unlike many other programming languages, Java is a portable language, which means that Java applications (programs) can run without any modification, on different platforms like Windows, Macintosh, Unix and so on. (ie. different computers running different operating systems).

Program Development and Execution
Now that you’ve gotten a brief introduction, let’s look at program development and execution, which consists of 5 steps: Edit, Compile, Load, Verify and Execute.

Step 1:

EDIT – consists of typing up your program using an editor. Common editors include vi (on a UNIX operating system) and notepad (on a Windows O/S). All java programs are saved with a .java file extension.

You can also use an Integrated Development Environment (IDE) to develop your Java programs. JCreator is a powerful IDE for Java. It allows you to edit and compile your programs, and provides many other useful features.

Step 2:

COMPILE – The Java compiler does not produce native executable code for a particular machine like a C compiler would. Instead, the java compiler translates your program into byte code. Unlike machine language, Java byte code is exactly the same on every platform. It is this feature that makes Java platform-independent, allowing Java applications to run on many different platforms! After a Java program has been compiled into byte code, it needs an interpreter that can execute it on any given platform.

Simply put, a Java compiler compiles (translates) your program into byte code. The byte code is stored in a file with a .class extension. The .class file is then interpreted by the Java interpreter (called the Java Virtual machine) during the execution phase.

Step 3:

LOAD – Before a program can be executed, it must be placed in memory. The class loader transfers the .class files that contain the byte code, to memory.

There are 2 types of Java programs: applications and applets

An application is a program that is usually stored and executed from the user’s computer. Applications are loaded into memory and then executed by the java interpreter.

An applet is a program that is stored on a remote computer that users connect to via a web browser. Applets are loaded from a remote computer into the browser, executed in the browser and discarded after execution.

Step 4:

VERIFY – Before the interpreter can execute the byte code in an applet, the byte code is verified by the byte code verifyer. This ensures that the applet being executed in your browser does not contain any bugs or viruses.

Step 5:

EXECUTE – During this step, your Java programs are executed.

In order to help you develop and execute your own Java programs, you will need the Java2 Platform, Standard Edition (J2SE), of which J2SE1.4 is a more recent version. You can learn more about it and download it for free from http://java.sun.com/j2se

A little bit of History
The Java programming language was developed by Sun Microsystems. It is a high-level, third generation programming language, like C, C++, Fortran and Perl. Furthermore, Java (like C++), is an Object oriented language which means data and member functions are encapsulated in objects.

What is OOP?
***Warning! Tech Talk Follows***

Object-oriented programming (OOP) is an approach to programming where data occurs in packages called objects (variables). In order to manipulate these objects, we need functions (called member functions) which come as necessary components of their objects.

Furthermore, we create objects (variables) and their member functions through classes. A class is a new kind of data type. Each class that you define is a collection of data (such as integers, doubles, strings) and member functions. Member functions are designed to manipulate objects of a class.

***End of Tech Talk***

The Basic Form of a Java Program
Java programs are made up of classes. Each class consists of data and member functions. Each function performs various tasks and then returns information to the program, allowing it to proceed.

Java has a huge collection of classes which are stored in Java class libraries. These class libraries are collectively known as the Java Application Programming Interfaces (APIs). Programmers often use these Java API classes when writing applications. …So, you don’t have to write an entire application from scratch! This can save a whole lot of time when writing a Java program.

murdok provides free highly informative newsletters for web developers, IT professionals and small business owners. We deliver 50 million email newsletters per month and have over 4,000,000 unique opt-in subscribers. From our extensive range of email newsletters we can provide you with a selection of newsletters that best meet your interests.

Related Articles

3 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles