Java Applications for Radiology Education
Java Frequently Asked Questions
What is Java?
What is Java good for?
How does Java compare with other languages like C, C++, and Perl?
How do you write a Java program?
What are some limitations of Java?
What is a Java Applet?
What is the Java Virtual Machine?
What is JavaScript?
How is Java different from CGI scripting?
For programmers, what are Javas key features?
What is Java?
(Back to top of FAQ)
- A programming language that looks like a hybrid between C and C++.
- Programming in Java is easier than in C or C++.
- Java programs can be run on any computer that implements the Java interpreter
(currently includes Macintosh OS, Windows 95, UNIX, and others).
What is Java good for?
(Back to top of FAQ)
- Adding complex interactive features to Web pages, especially those involving graphics. These
features can involve
a graphical user interface (GUI) separate from that of the Web browser.
- Writing programs much more easily for getting files and images from the Internet.
- Writing programs in which the same code file can be run on multiple computer
platforms (Macintosh OS, Windows 95, UNIX, etc.) without modification.
- Writing programs that can be distributed over the Internet.
- A kinder, gentler alternative to C.
How does Java compare with other languages like C, C++, and Perl?
(Back to top of FAQ)
|
C or C++ |
Java |
Perl |
Speed |
++++ |
+++ |
+ |
Portability |
+ |
+++ |
+++ |
Security |
0 |
+++ |
+ |
Ease of Programming |
+ |
++ |
++ |
How do you write a Java program?
(Back to top of FAQ)
- Write your program in Java. (The syntax is similar to C).
- Compile your Java program with a Java compiler (available for Macintosh OS, Windows 95, UNIX, and others). This produces a binary Bytecode file.
- Run the Bytecode file within a Java interpreter (available for Macintosh OS, Windows 95, UNIX, and others). In this case, the Bytecode file is called a standalone application.
- Alternatively, put the bytecode file on a Web server so that it can be run within a Web browser.
This allows your Java program to be distributed over the Internet. In this case, the Bytecode file
is called an applet.
What are some limitations of Java?
(Back to top of FAQ)
- A young language, its specifications are still evolving.
- Many Java interpreters are sloppy in implementing the Java standard, so that the same Java program
may not behave exactly the same on all platforms.
- Java programs are approximately 2-3 times slower than their native C equivalents.
However, dynamic native (Just-In-Time) compilers are being developed.
What is a Java Applet?
(Back to top of FAQ)
- A compiled Java program that is embedded within a Web page and run inside a Web browser.
What is the Java Virtual Machine?
(Back to top of FAQ)
- The specification of the ideal Java interpreter. It is the ideal, imaginary computer
on which the Bytecode runs.
What is JavaScript?
(Back to top of FAQ)
- A scripting language whose code is embedded within HTML documents and can only be run
inside a Web browser.
- A completely separate entity from Java, despite their similar names.
- Main feature: can load HTML documents from the Internet or create HTML documents on the
fly, based on user input.
- Limitations: no graphics or networking capabilities other than its ability to
format HTML documents.
How is Java different from CGI scripting?
(Back to top of FAQ)
- In CGI scripting, all the work is done by a C or Perl program running on a special Web server.
In Java, the Web browser does all the work, so no special Web server is necessary.
- CGI requires a specially configured Web server, and you must be able to program in another
language like C or Perl.
For programmers, what are Javas key features?
(Back to top of FAQ)
- Strongly typed language: the Java compiler catches more potential errors.
- No pointers: memory cannot be accidentally overwritten or otherwise corrupted.
- Memory management by garbage collection: the programmer does not have to worry about memory leaks.
- Runs approximately 2-3 times slower than equivalent native C program.
- Built-in multithreading (parallel processing).
- Standard, cross-platform libraries for GUI and networking.
- Built-in security: the Java interpreter includes a security manager that restricts access to the
clients filesystem, network connection, and window system.