Teach Yourself Java Programming in 24 Hours |
|||
|
ISBN : 1575212706 |
|||
![]() Cover Design - Teach Yourself Java Programming in 24 Hours |
For your free electronic copy of this book please verify the numbers below. (We need to do this to make sure you're a person and not a malicious script) | ||
|
Sample Chapter From Teach Yourself Java Programming in 24 Hours Copyright © Rogers Cadenhead |
|||
Next Stop: JavaBefore 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 Java Developer\'s Kit. All of the examples in this book use the Kit, and you are encouraged to forsake all other Java programming tools as you go through the remaining 23 hours of tutelage. The material will make more sense to programmers using the Kit, and using the Kit builds experience that will be beneficial no matter which development software you use later on. The Java Developer\'s Kit (also referred to as the JDK) is in version 1.1 as of this writing. It is a set of tools that enable you to write and test Java programs. Users of Microsoft Windows systems may be dismayed to learn that the Kit is not graphical. You run programs from a command line (the familiar C:\> prompt on Windows systems) 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 95 system. The Java program PlayGame.java is compiled, and then it is run. What You Need to Write ProgramsAs explained in Hour 1, you should have installed the current version of the Java Developer\'s Kit on your system. The kit contains tools that enable you to compile and test Java programs. You also need a word processor to write programs. With most programming languages, computer programs are written by entering text into a word processor (also called a text editor). Some programming languages, such as Visual C++ from Microsoft, come with their own word processor. SunSoft Java WorkShop, an advanced programming tool from Java\'s developers, also comes with its own editor. Java programs are simple text files without any special features such as centered text, boldface text, or other enhancements. They can be written with any word processing program that can create text files. Microsoft Windows systems have several word processors you can use, including Notepad, WordPad, and the DOS program edit. Apple Macintosh users can create programs with Simple Text or other editors such as BBEdit Lite. Any of these programs will work fine.
You also can use more sophisticated word processors, such as Microsoft Word, if you remember to save the programs as text. This option has different names depending on the program you are using. In Word, the file should be saved as a file of type Text Only. Other programs call these files DOS text, ASCII text, or something similar.
After you have decided which word processor you will use to write Java programs, go ahead and load it so you can start writing a program. Windows 95 users must take one extra step before saving any Java-related files to disk: The .java file extension must be associated with the selected word processor. To do this, you need to create a new .java file and load it into the word processor you\'ll be using during this book. To create the file, open up any file folder on your system and press the right-click button on your mouse. A pop-up menu will appear that will enable you to choose the New | Text Document option. Choose this option and a file named New Text Document.txt will appear. Change the name of this file to Anything.java and confirm that you really want to choose the new name. If you have never written Java programs on your computer, the .java file extension should not be associated with any programs yet. Double-click the Anything.java file with the left mouse button and a dialog box will appear, enabling you to choose a program for opening the .java file. Choose your preferred word processor, first making sure to click the option Always use this program to open this file.
|
|||