Page 49 - Introduction to Programming with Java: A Problem Solving Approach
P. 49
Plain old blah Web pages? Prior to Java, Web pages were limited to one-way communication with their users. Web pages sent information to users, but users did not send information to Web pages. More specifi- cally, Web pages displayed information for users to read, but users did not enter data for Web pages to pro- cess. When the Web community figured out how to embed Java programs inside Web pages, that opened the door to more exciting Web pages. Java-embedded Web pages are able to read and process user input, and that provides users with a more enjoyable, interactive experience.
Java Today
Today, programmers use Java in many different environments. They still embed Java programs in Web pages, and those programs are called applets. The initial popularity of applets helped Java grow into one of the leading programming languages in the world. Although applets still play a significant role in Java’s current success, some of the other types of Java programs are coming close to surpassing applets in terms of popularity, and some have already surpassed applets in terms of popularity.
To help with the small talk at your next Java social event, we’ll provide brief descriptions of some of the
more popular uses for Java. An applet is a Java program that’s embedded in a Web page. A servlet is a Java
program that supports a Web page, but it runs on a different computer than the Web page. A JavaServer Page
(JSP) is a Web page that has fragments of a Java program (as opposed to a complete Java program, like an ap-
plet) embedded in it. An advantage of servlets and JSPs over applets is that servlets and JSPs lead to Web pages
that display more quickly. A Micro Edition (ME) Java application is a Java program that runs on a limited-
resource device, for example, a device that has a limited amount of memory. Examples of limited-resource
devices are consumer appliances such as mobile phones and television set-top boxes. A Standard Edition (SE)
Java application is a Java program that runs on a standard computer—a desktop or a laptop. In this book, we Apago PDF Enhancer
focus on SE Java applications as opposed to the other types of Java programs because SE Java applications are the most general purpose and they provide the best environment for learning programming concepts.
1.8 First Program—Hello World
Earlier you learned what it means to compile and run a Java program. But learning by reading only goes so far. It’s now time to learn by doing. In this section, you’ll enter a Java program into a computer, compile the program, and run it. What fun!
Development Environments
There are different ways to enter a Java program into a computer. You can use an integrated development environment, or you can use a plain text editor. We’ll briefly describe the two options.
An integrated development environment (IDE) is a rather large piece of software that allows you to enter, compile, and run programs. The entering, compiling, and running are all part of a program’s develop- ment, and those three functions are integrated together into one environment. Thus, the name “integrated development environment.” Some IDEs are free and some are quite expensive. We provide tutorials for several popular IDEs on the book’s Web site.
A plain text editor is a piece of software that allows you to enter text and save your text as a file. Plain text editors know nothing about compiling or running a program. If you use a plain text editor to enter a program, you’ll need to use separate software tools to compile and run your program. Note that word pro- cessors, like Microsoft Word, can be called text editors, but they’re not plain text editors. A word processor allows you to enter text and save your text as a file. But the saved text is not “plain.” When a word processor saves text to a file, it adds hidden characters that provide formatting for the text like line height, color, etc.
1.8 First Program—Hello World 15