Sams Teach Yourself Java 2 in 24 Hours
- Table of Contents
- Copyright
- About the Author
- About the Technical Editor
- Acknowledgments
- We Want to Hear from You!
- Reader Services
- Introduction
- Hour 1. Becoming a Programmer
- Hour 2. Writing Your First Program
- Hour 3. Vacationing in Java
- Hour 4. Understanding How Java Programs Work
- Part II: Learning the Basics of Programming
- Hour 5. Storing and Changing Information in a Program
- Hour 6. Using Strings to Communicate
- Hour 7. Using Conditional Tests to Make Decisions
- Hour 8. Repeating an Action with Loops
- Part III: Working with Information in New Ways
- Hour 9. Storing Information with Arrays
- Hour 10. Creating Your First Object
- Hour 11. Describing What Your Object Is Like
- Hour 12. Making the Most of Existing Objects
- Part IV: Programming a Graphical User Interface
- Hour 13. Building a Simple User Interface
- Hour 14. Laying Out a User Interface
- Hour 15. Responding to User Input
- Hour 16. Building a Complex User Interface
- Part V: Creating Multimedia Programs
- Hour 17. Creating Interactive Web Programs
- Hour 18. Handling Errors in a Program
- Hour 19. Creating a Threaded Program
- Hour 20. Reading and Writing Files
- Part VI: Creating Multimedia Programs
- Hour 21. Using Fonts and Color
- Hour 22. Playing Sound Files
- Hour 23. Working with Graphics
- Hour 24. Creating Animation
- Part VII: Appendixes
- Appendix A. Tackling New Features of Java 2 Version 1.4
- Appendix B. Using the Java 2 Software Development Kit
- Appendix C. Programming with the Java 2 Software Development Kit
- Appendix D. Using Sun ONE Studio
- Appendix E. Where to Go from Here: Java Resources
- Appendix F. This Book's Web Site
Next Stop: Java
Before you can start writing Java programs, you need to acquire and set up some kind of Java programming software. Although several different products are available for the development of Java programs, including many terrific ones that make programming much easier, the starting place for most new Java programmers is the Software Development Kit, a set of tools for writing, debugging, and running Java programs. All of the examples in this book were created and tested using the Kit, but they can be created with any Java development tool that supports the current version of the language.
The Software Development Kit (also referred to as the SDK) is in version 1.4 as of this writing. Whenever Sun releases a new version of Java, the first tool that supports it is the Kit.
To create all of the programs in this book, you must either use Software Development Kit 1.4 or another Java programming tool that fully supports all of version 1.4's features.
There are many different software packages that offer the capability to create Java programs, but all of these are not created equally when language support is concerned. Some of these programming tools only support Java 1.0, the initial version of the language, which was released by Sun Microsystems in late 1995. Other tools support Java 1.1, which was released in mid-1997, version 1.2 from 1998, or version 1.3 from 2000.
Some operating systems such as Mac OS X and Red Hat Linux 7.1 include a copy of the SDK, but it's probably not the current version. The kit in OS X supports version 1.3 of Java and the one in Red Hat 7.1 supports version 1.1. Before using an SDK that was included with your operating system, make sure it supports Java version 1.4.
Users of Microsoft Windows systems may be dismayed to learn that the Software Development Kit is not graphical. You run programs from a command line (the C:\> or D:\> prompt that will be familiar to MS-DOS users) instead of using a mouse and a point-and-click environment. Figure 1.2 shows the Kit in use in an MS-DOS window on a Windows 2000 system. The Java program WarGames.java is compiled, and then it is run.
Figure 1.2 A program being compiled and run with the Software Development Kit.
Official Documentation
Sun Microsystems offers comprehensive documentation for the Java language in Web page format. You don't need this information to use this book because each topic is discussed fully as it is introduced, but these pages will come in handy when you write your own programs.
You can download the entire documentation, but it might be more convenient to browse it as needed from Sun's Web site. The most up-to-date Java documentation is available at http://java.sun.com/j2se/1.4/docs.
Workshop: Installing a Java Development Tool | Next Section

Account Sign In
View your cart