SAMS teach yourself Java 2 in 21 days
SAMS teach yourself Java 2 in 21 days
Sams Teach Yourself Java in 21 Days, Second Edition is known for its clear and personable writing, its extensive use of examples, and its logical step-by-step organization. This new edition maintains and improves upon all these qualities, while updating and revising the material to cover the latest developments in Java and the way the language is used today.
Introduction. WEEK 1. JAVA'S FUNDAMENTAL CONCEPTS. Day 1. 21st Century Java. Exploring Java 2.Java's Past, Present, and Future. Interactive Web Programming. Java Grew from a Little Oak. Versions of the Language. Java's Outlook.Why to Choose Java.Java Is Object-Oriented. Java Is Easy to Learn. Java Is Platform Neutral.Diving into Java Programming.Selecting a Java Development Tool. Installing the Software Development Kit.Your First Java Program.Creating the Source File.Summary. Q&A. Quiz.Questions. Answers.Exercises.Day 2. Object-Oriented Programming. Thinking in Terms of Objects. Objects and Classes.Object Reuse.Attributes and Behavior.Attributes of a Class of Objects. Behavior of a Class of Objects. Creating a Class. Running the Program.Organizing Classes and Class Behavior.Inheritance. Creating a Class Hierarchy. Inheritance in Action. Single and Multiple Inheritance. Interfaces. Packages.Summary. Q&A. Quiz.Questions. Answers.Exercises.Day 3. The ABCs of Java. Statements and Expressions. Variables and Data Types.Creating Variables. Naming Variables. Variable Types. Assigning Values to Variables. Constants.Comments. Literals.Number Literals. Boolean Literals. Character Literals. String Literals.Expressions and Operators.Arithmetic. More About Assignment. Incrementing and Decrementing. Comparisons. Logical Operators. Operator Precedence.String Arithmetic. Summary. Q&A. Quiz.Questions. Answers.Exercises.Day 4. Working with Objects. Creating New Objects.Using new. What new Does. A Note on Memory Management.Accessing and Setting Class and Instance Variables.Getting Values. Changing Values. Class Variables.Calling Methods.Nesting Method Calls. Class Methods.References to Objects. Casting and Converting Objects and Primitive Types.Casting Primitive Types. Casting Objects. Converting Primitive Types to Objects and Vice Versa.Comparing Object Values and Classes.Comparing Objects. Determining the Class of an Object.Summary. Q&A. Quiz.Questions. Answers.Exercises.Day 5. Lists, Logic, and Loops. Arrays.Declaring Array Variables. Creating Array Objects. Accessing Array Elements. Changing Array Elements. Multidimensional Arrays.Block Statements. if Conditionals. switch Conditionals. for Loops. while and do Loops.while Loops. do...while Loops.Breaking Out of Loops.Labeled Loops. The Conditional Operator.Summary. Q&A. Quiz.Questions. Answers.Exercises.Day 6. Creating Classes and Methods. Defining Classes. Creating Instance and Class Variables.Defining Instance Variables. Class Variables.Creating Methods.Defining Methods. The this Keyword. Variable Scope and Method Definitions. Passing Arguments to Methods. Class Methods.Creating Java Applications.Helper Classes.Java Applications and Command-Line Arguments.Passing Arguments to Java Applications. Handling Arguments in Your Java Application.Creating Methods with the Same Name, Different Arguments. Constructor Methods.Basic Constructors Methods. Calling Another Constructor Method. Overloading Constructors Methods.Overriding Methods.Creating Methods That Override Existing Methods. Calling the Original Method. Overriding Constructors.Finalizer Methods. Summary. Q&A. Quiz.Questions. Answers.Exercises.Day 7. Writing Java Applets. How Applets and Applications Are Different. Applet Security Restrictions.Choosing a Java Version.Creating Applets.Major Applet Activities. An Example Applet.Including an Applet on a Web Page.The APPLET Tag. Testing the Result. Putting Applets on the Web.More About the APPLET Tag.ALIGN. HSPACE and VSPACE. CODE and CODEBASE. The OBJECT Tag.Java Archives. Passing Parameters to Applets. Developing Java 2 Applets.Using the Plug-in on a Web Page. Running the Plug-in.Summary. Q&A.Questions. Answers.Exercises.WEEK 2. SWING AND OTHER VISUAL JAVA PROGRAMMING. Day 8. Working with Swing. Creating an Application.Creating an Interface. Developing a Framework. Closing a Window. Creating a Component. Adding Components to a Container. Adding Components to an Applet.Working with Components.Image Icons. Labels. Text Fields. Text Areas. Scrolling Panes. Scrollbars. Check Boxes and Radio Buttons. Drop-Down Lists and Combo Boxes.Summary. Q&A.Questions. Answers.Exercises.Day 9. Building a Swing Interface. Swing Features.Setting the Look and Feel. Standard Dialog Boxes. An Example: The Info Application. Sliders. Scroll Panes. Toolbars. Progress Bars.Summary. Q&A.Questions. Answers.Exercises.Day 10. Arranging Components on a User Interface. Basic Interface Layout.Laying Out an Interface. Flow Layout. Grid Layout. Border Layout.Mixing Layout Managers. Card Layout. Grid Bag Layout.Designing the Grid. Creating the Grid. Determining the Proportions. Adding and Arranging the Components. Making Adjustments.Cell Padding and Insets. Summary. Q&A.Questions. Answers.Exercises.Day 11. Responding to User Input. Event Listeners.Setting Up Components. Event-Handling Methods.Working with Methods.Action Events. Adjustment Events. Focus Events. Item Events. Key Events. Mouse Events. Mouse Motion Events. Window Events. An Example: An RGB-to-HSB Converter. Designing the Layout. Defining the Subpanels. Converting Between sRGB and HSB. Handling User Events.Summary. Q&A.Questions. Answers.Exercises.Day 12. Color, Fonts, and Graphics. Graphics Classes. Creating a Drawing Surface.Casting a Graphics2D Object. Creating an Application. The Graphics Coordinate System.Drawing and Filling.Lines. Rectangles. Polygons. Ovals. Arcs. Copying and Clearing.Text and Fonts.Creating Font Objects. Drawing Characters and Strings. Finding Information About a Font.Color.Using Color Objects. Testing and Setting the Current Colors.Advanced Graphics Operations Using Java2D.User and Device Coordinate Spaces. Specifying the Rendering Attributes. Creating Objects to Draw. Drawing Objects.Summary. Q&A.Questions. Answers.Exercises.Day 13. Threads and Animation. Creating Animation in Java.Painting and Repainting. Animating a Component. Controlling Animation Through Threads. Writing a Threaded Program. A Threaded Clock Application. Stopping a Thread.Retrieving and Using Images.Getting Images. Drawing Images. A Note About Image Observers.Creating Animation Using Images.Pixel Pete Takes a Walk. Tracking Image Loading.Summary. Q&A.Questions. Answers.Exercises.Day 14. JavaSound. Retrieving and Using Sounds. JavaSound.MIDI Files. Playing a MIDI File. Manipulating Sound Files.Summary. Q&A.Questions. Answers.Exercises.WEEK 3. JAVA'S ADVANCED FEATURES. Day 15. Packages, Interfaces, and Other Class Features. Modifiers.Access Control for Methods and Variables.Static Variables and Methods. Final Classes, Methods, and Variables.Variables. Methods. Classes.Abstract Classes and Methods. Packages. Using Packages.Full Package and Class Names. The import Declaration. Name Conflicts. A Note About CLASSPATH and Where Classes Are Located.Creating Your Own Packages.Picking a Package Name. Creating the Folder Structure. Adding a Class to a Package. Packages and Class Access Control.Interfaces.The Problem of Single Inheritance. Interfaces and Classes. Implementing and Using Interfaces. Implementing Multiple Interfaces. Other Uses of Interfaces.Creating and Extending Interfaces.New Interfaces. Methods Inside Interfaces. Extending Interfaces. Creating an Online Storefront.Inner Classes. Summary. Q&A.Questions. Answers.Exercises.Day 16. Error Handling and Security. Exceptions, the Old and Confusing Way. Java Exceptions. Managing Exceptions.Exception Consistency Checking. Protecting Code and Catching Exceptions. The finally Clause.Declaring Methods That Might Throw Exceptions.The throws Clause. Which Exceptions Should You Throw? Passing On Exceptions. throws and Inheritance.Creating and Throwing Your Own Exceptions.Throwing Exceptions. Creating Your Own Exceptions. Combining throws, try, and throw.When and When Not to Use Exceptions.When to Use Exceptions. When Not to Use Exceptions. Bad Style Using Exceptions.Using Digital Signatures to Identify Applets.A Digital Signature Example. Browser-Specific Signatures. Security Policies.Summary. Q&A.Questions. Answers.Exercises.Day 17. Handling Data Through Java Streams. Introduction to Streams.Using a Stream. Filtering a Stream.Byte Streams.File Streams.Filtering a Stream.Byte Filters.Character Streams.Reading Text Files. Writing Text Files.Files and Filename Filters. Summary. Q&A.Questions. Answers.Exercises.Day 18. Object Serialization and Reflection. Object Serialization.Object Output Streams. Object Input Streams. Transient Variables.Inspecting Classes and Methods with Reflection.Inspecting and Creating Classes. Working with Each Part of a Class. Inspecting a Class.Remote Method Invocation.RMI Architecture. Creating RMI Applications.Summary. Q&A.Questions. Answers.Exercises.Day 19. Communicating Across the Internet. Networking in Java.Creating Links Inside Applets. Opening Web Connections. Opening a Stream over the Net. Sockets. Socket Servers. Implementing the Server. Testing the Server.Summary. Q&A.Questions. Answers.Exercises.Day 20. Working with JavaBeans. Reusable Software Components.The Goal of JavaBeans. How JavaBeans Relates to Java. The JavaBeans API.Development Tools.JavaBeans Development Kit.Working with JavaBeans.Bean Containers. Placing a Bean. Adjusting a Bean's Properties. Creating Interactions Between Beans. Creating a JavaBeans Program. Working with Other JavaBeans.Summary. Q&A.Questions. Answers.Exercises.Day 21. Java Database Connectivity and Data Structures. Java Database Connectivity.Database Drivers. The JDBC-ODBC Bridge. Connecting to an ODBC Data Source. JDBC Drivers.Data Structures. Java Data Structures.Iterator. Bit Sets. Vectors. Stacks. Map. Hash Tables.Summary. Q&A.Questions. Answers.Exercises.APPENDIXES. Appendix A. Configuring the Software Development Kit. Using a Command-Line Interface.Opening Folders in MS-DOS. Creating Folders in MS-DOS. Running Programs in MS-DOS.Configuring the Software Development Kit.Setting Up the PATH Command. Setting Up the CLASSPATH Command.UNIX Configuration.Fixing Class Not Found Errors on Other Platforms.Appendix B. Using a Text Editor with the Software Development Kit. Choosing a Text Editor. Creating a File Association in Windows.Deleting an Existing File Association. Creating a New Association. Associating an Icon with a File Type.Appendix C. The Software Development Kit. An Overview of the SDK. The java Interpreter. The javac Compiler. The appletviewer Browser. The javadoc Documentation Tool. The jdb Debugger.Debugging Applications. Debugging Applets. Advanced Debugging Commands.Using System Properties. Summary. Q&A.Index.
「Nielsen BookData」 より