Chapter 2. A First Application
Before getting into the details of the Java language, let’s jump right into some working code. In this chapter, we’ll build a friendly little application that illustrates a number of techniques we use throughout the book. We’ll take this opportunity to introduce general features of the Java language and of Java applications. However, many details won’t be fleshed out here, but in subsequent chapters.
This chapter also serves as a brief introduction to the object-oriented and multithreaded features of Java. If these concepts are new to you, you can take comfort in the knowledge that encountering them for the first time in Java should be a straightforward and pleasant experience. If you have worked with another object-oriented or multithreaded programming environment, clear your mind; you will especially appreciate Java’s simplicity and elegance.
We can’t stress enough the importance of experimentation as you learn new concepts. Don’t just examine the examples—run them. Copy the source code from the accompanying CD-ROM, or from our web site at http://www.oreilly.com/catalog/learnjava. Compile the programs on your machine, and run them.
If you follow along with the online examples, be sure to take some time and compile them locally. Then, turn our examples into your example: play with them; change their behavior, break them, fix them, and, as Java architect Arthur van Hoff would say: “Have fun!”
HelloJava1
In the tradition of introductory programming texts, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access