Term of the Moment

hybrid


Look Up Another Term


Definition: Java


An object-oriented programming language from Oracle that is platform independent. Developed by Sun in the early 1990s (Oracle acquired Sun in 2010), and modeled after C++, Java was originally designed for embedded applications in set-top boxes and other consumer electronics. Java ignited a revolution when Sun transitioned it to the Web in 1994. It is used in desktop computers, servers, mobile devices and Blu-ray players with more than three billion installations as of 2020.

Applet, App and Servlet
When a Java program is launched from a Web page, the program is called a Java "applet." When run without the Web browser on a user's machine, it is a Java "application." When running in a Web server, it is a Java "servlet."

Write Once-Run Anywhere
Java embodies the "write once-run anywhere" model. For example, a Java program can be moved from a Unix server to a Windows server with minimal modification most of the time. This is accomplished because Java source code is first compiled into an intermediate "bytecode" language. In order to run the bytecode, it is either compiled into machine code and then run or executed a line at a time via the Java interpreter, a runtime engine known as the "Java Virtual Machine" (JVM). There are JVMs for all major hardware platforms, which is what makes Java cross platform. When users are notified to update Java in their computers, they are updating the runtime engine (see Java Virtual Machine). See Java platform, servlet, JSP, Jini, garbage collection, CaffeineMark and caffeine based.

Java vs. JavaScript
Although they share a similar-sounding name, Java is not JavaScript (for the difference, see JavaScript).

The following Java example of changing Fahrenheit to Celsius is rather wordy compared to the C example in this encyclopedia. Java is designed for GUI-based applications, and several extra lines of code are necessary here to allow input from a terminal.

 import java.io.*;
 class Convert {
  public static void main(String[]args)
  throws IOException {
   float fahr;
   StreamTokenizer in=new
     StreamTokenizer
       (new InputStreamReader(System.in));
   System.out.print("Enter Fahrenheit ");
   in.nextToken();
   fahr = (float) in.nval;
   System.out.println ("Celsius is " +
                        (fahr-32)*5/9);
  }
 }





Java Uses an Intermediate Language
Java source code is compiled into an intermediate language called "bytecode." The bytecode can be run in any hardware that has a Java Virtual Machine (JVM) for that machine platform. Thus, the "write once-run anywhere" concept.






Java Runs on Clients and Servers
When a Java program is called by a Web page from the client machine, it is dubbed an "applet." When it runs on the server, it is a "servlet." When running stand-alone in a user's computer, it is a Java "application."