header ad

Introduction to JAVA programming language


Java, a computer programming language developed by Sun Microsystems, enables applications to run on the Internet in the same way as word processing and spreadsheet programs are run on your computer.

Introduction to JAVA programming language

It was the first to include inline sounds and animations on a Web page. Instead of first reading it and perhaps filling out a form, users can now play games, calculate spreadsheets, chat in realtime, get continuously updated data, and much more. Inline sounds that play in realtime whenever a user loads a page, Music that plays in the background on a page.

Java began life as a programming language for software for consumer electronics, devices such as toasters, microwave ovens, and personal digital diaries. Software for consumer devices has some unique design requirements. For instance, the software needs to be able to work on new computer chips as they are introduced mandates of then change the chips they are using as new chips become more cost-effective or introduce new features.

The software also needs to be extremely reliable because when consumer produce fails, the manufacturer typically has to replace the entire device. the java developers realized that an architecture natural language like Java would be ideal for programming on the Internet because a program could run on all of the Internet. In fact, all of the design goals of Java made it ideally suited for Internet programming.

At that point, the development of java took on new importance for Sun. The team wrote a Web browser, called HotJava, which was the first Web browser to support Java applets.

An applet is a small Java program that can be embedded in another application. you can include an applet in an HTML document to provide interactive, executable content on a Web page. HotJava demonstrated the power of the Java language in a very visible fashion to programmers and to the rest of the world.

Programmers started tinkering with the Alpha release of Java that Sun made available, creating all sorts of "cool" applets. their experience and feedback helped refine the language and its application programming interface (API). At the same time, Sun released the first Beta version of the language.

Netscape announced their Version 2.0 of its Web browser. Netscape Navigator would support java applets. this support served only to increase the already strong interest in Java technology, both in the computing world and on the Internet. With companies like IBM, SGI, Microsoft, and Oracle licensing the Java technology from Sun, more software and hardware products will be incorporating Java technology.


What is Java?


Java is a simple, object-oriented, distributed, interpreted, robust, secure, architecture natural, portable, high-performance, multiheaded, and dynamic language. Java has the following characteristics:

Simple Java is a simple language. but what exactly do we mean by simple? One design goal was to create a language that a programmer could learn quickly, so the number of language constructs has been kept small. Another design goal was to make the language look familiar to a majority of programmers for ease of migration.

If you are a C or C++ programmer, you will find that Java uses many of the language specifications as that of C and C++. in order to keep the language both simple and familiar, the Java designers removed a number of features available in C and C++. these features are mostly ones that led to poor programming practices or were rarely used. For example, Java does not support the Goto statement instead, it provides labeled break and continue statements and exception handling.

Java does not use header files and it eliminates the C preprocessor. Java eliminates the operator overloading and multiple inheritance features of C++. Since java does not have structure and array and it uses strings as objects, there is no need for pointers. Java automatically handles the referencing and dereferencing of objects. Java also implements automatic garbage collection, so you do not have to worry about memory management issues.


Object-oriented


Java is an object-oriented programming language. That is, as a programmer, you focus on the data in your application and methods that manipulate that data, rather than thinking strictly in terms of procedures. in an object-oriented system, a class is a collection of data and methods that operate on that data.

Taken together, the data and methods describe the state and behavior of an object. Classes are arranged in a hierarchy so that a subclass can inherit behavior from its superclass. A class hierarchy always has a root class: this is a class with very general behavior. To take an example from the natural world, you might define a "living thing" class to be the root of your class hierarchy. this class could have two subclasses "animal" and "plant". you might further define the 'mammal' class as a subclass of 'animal'.

Finally, if you defined a "human" class as a subclass of 'mammal' the 'human' class would inherit behavior from 'mammal', 'animal', and 'living thing'.


How Java Works?


Java is a compiled language, which means that after a Java program is written, the program must be run through a compiler to turn the program into an object module that a computer can read. In java, a single compiled version of the program, called Java bytecode, is created by a compiler. Interpreters on different computers, such as a PC, Mac, or NT workstation, understand the Java bytecode and run the program.

In this way, a Java program can be created once and then used on many linds of computers. Java-enabled browsers contain Java bytecode interpreters. After a Java program is compiled into bytecodes, it is put on a Web server. When you visit a home page with a Java applet on it, the applet downloads to your computer. to run the java applet, you need a Web browser that has a bytecode interpreter that can run Java applets. Many browsers, such as Internet Explorer have these interpreters built into them.

Because Java applets are programs that run on your computer, theoretically they could carry a virus just like any other computer program could. To ensure that no viruses infect your computer the applet first goes through a process of verification. This is a process that makes sure that the byte codes can be run safely.

After the bytecode has been verified, it is put into a restricted area in your computer's memory and run. By putting the applet into this special area of your computer, further care is taken that no virus can harm your computer.


Java Applets


When Java programs are run inside a browser, they are called applets. When you visit a Website that has a Java applet on it, the applet is downloaded automatically from the Web server, and then run automatically in your browser. Java Applets can be run on any computer, such as a PC or a Unix workstation.


Comparing Java with JavaScript


Java, the "big brother" of JavaScript, is the most obvious choice to use if you need to fill in some of the holes in JavaScript. Java includes many features, including communication across the network and graphics capabilities. java is harder to learn than JavaScript, but you may not need to learn it. Many ready-to-use Java applets are available.

Remember that JavaScript can do many things Java can't do including modifying HTML during its display, validating forms, and handling user-generated events. 

Post a Comment

0 Comments